Beheben aggregierte und Nicht-aggregierte mix-Fehler, WENN die Ergebnisse im Tableau

Ich versuche zu tun, die folgenden Schritte im Tableau.

Wenn die gewählte Kennzahl ist der Umsatz oder Volumen (nicht aggregierten Felder), dann rufen Sie calculation1 sonst Berechnung 2.

IF ATTR([Choose Key Figure])= "Sales"
THEN [Periodic Calculation]
ELSEIF ATTR([Choose Key Figure])= "Volume"
THEN [Periodic Calculation]
ELSEIF ATTR([Choose Key Figure])="profit"
THEN [Periodic Calculation 2]
ELSEIF ATTR([Choose Key Figure])="price per unit"
THEN [Periodic Calculation 2]
END 

Aber ich erhalte die folgende Fehlermeldung:
"Nicht mischen kann aggregierte und nicht-aggregierte Vergleiche oder Ergebnisse 'WENN' Ausdrücke."

Periodische Berechnung

IF [Choose Vol/NNS]="NNS"
AND [Choose Period]=-1
AND DATEDIFF("month",[Dates], [Choose Current Month])<2
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>0
then [(Actuals+Planned) NNS]
ELSEIF [Choose Vol/NNS]="Volume"
AND    [Choose Period]=-1
AND DATEDIFF("month",[Dates], [Choose Current Month])<2
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>0
THEN [(Actuals + Planned) Volume]
ELSEIF [Choose Vol/NNS]="NNS"
AND [Choose Period]=-3
AND DATEDIFF("month",[Dates], [Choose Current Month])<4
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>0
then [(Actuals+Planned) NNS]
ELSEIF [Choose Vol/NNS]="Volume"
AND [Choose Period]=-3
AND DATEDIFF("month",[Dates], [Choose Current Month])<4
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>0
THEN [(Actuals + Planned) Volume]
ELSEIF [Choose Vol/NNS]="NNS"
AND [Choose Period]=-6
AND DATEDIFF("month",[Dates], [Choose Current Month])<7
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>0
then [(Actuals+Planned) NNS]
ELSEIF [Choose Vol/NNS]="Volume"
AND     [Choose Period]=-6
AND DATEDIFF("month",[Dates], [Choose Current Month])<7
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>0
THEN [(Actuals + Planned) Volume]
ELSEIF [Choose Vol/NNS]="NNS"
AND     [Choose Period]=1
AND DATEDIFF("month",[Dates], [Choose Current Month])<0
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>-2
THEN [(Actuals+Planned) NNS]
ELSEIF [Choose Vol/NNS]="Volume"
AND     [Choose Period]=1
AND DATEDIFF("month",[Dates], [Choose Current Month])<0
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>-2
THEN [(Actuals + Planned) Volume]
ELSEIF [Choose Vol/NNS]="NNS"
AND     [Choose Period]=3
AND DATEDIFF("month",[Dates], [Choose Current Month])<0
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>-4
THEN [(Actuals+Planned) NNS]
ELSEIF [Choose Vol/NNS]="Volume"
AND     [Choose Period]=3
AND DATEDIFF("month",[Dates], [Choose Current Month])<0
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>-4
THEN [(Actuals + Planned) Volume]
ELSEIF [Choose Vol/NNS]="NNS"
AND     [Choose Period]=6
AND DATEDIFF("month",[Dates], [Choose Current Month])<0
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>-7
THEN [(Actuals+Planned) NNS]
ELSEIF [Choose Vol/NNS]="Volume"
AND     [Choose Period]=6
AND DATEDIFF("month",[Dates], [Choose Current Month])<0
AND
DATEDIFF("month",[Dates],[Choose Current Month] )>-7
THEN [(Actuals + Planned) Volume]

ENDE

Periodische Berechnung 2

IF [Choose IGM$/NNSP]="NNSP"
AND [Choose Period]=-1
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<2
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>0
THEN [(Actuals + Planned) NNSP]
ELSEIF [Choose IGM$/NNSP]="IGM$"
AND [Choose Period]=-1
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<2
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>0
THEN [(Actuals + Planned) IGM$]
ELSEIF [Choose IGM$/NNSP]="NNSP"
AND [Choose Period]=-3
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<4
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>0
THEN [(Actuals + Planned) NNSP]
ELSEIF [Choose IGM$/NNSP]="IGM$"
AND [Choose Period]=-3
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<4
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>0
THEN [(Actuals + Planned) IGM$]
ELSEIF [Choose IGM$/NNSP]="NNSP"
AND [Choose Period]=-6
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<7
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>0
THEN [(Actuals + Planned) NNSP]
ELSEIF [Choose IGM$/NNSP]="IGM$"
AND [Choose Period]=-6
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<7
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>0
THEN [(Actuals + Planned) IGM$]
ELSEIF [Choose IGM$/NNSP]="NNSP"
AND [Choose Period]=1
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<0
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>-2
THEN [(Actuals + Planned) NNSP]
ELSEIF [Choose IGM$/NNSP]="IGM$"
AND [Choose Period]=1
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<0
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>-2
THEN [(Actuals + Planned) IGM$]
ELSEIF [Choose IGM$/NNSP]="NNSP"
AND [Choose Period]=3
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<0
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>-4
THEN [(Actuals + Planned) NNSP]
ELSEIF [Choose IGM$/NNSP]="IGM$"
AND [Choose Period]=3
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<0
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>-4
THEN [(Actuals + Planned) IGM$]
ELSEIF [Choose IGM$/NNSP]="NNSP"
AND [Choose Period]=6
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<0
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>-7
THEN [(Actuals + Planned) NNSP]
ELSEIF [Choose IGM$/NNSP]="IGM$"
AND [Choose Period]=6
AND ATTR(DATEDIFF("month",[Dates], [Choose Current Month]))<0
and ATTR(DATEDIFF("month",[Dates],[Choose Current Month] ))>-7
THEN [(Actuals + Planned) IGM$]
END

Kann mir jemand helfen, wie man diesen Fehler umgehen?

Dank.

InformationsquelleAutor Shreya Bhattacharya | 2015-09-27

Schreibe einen Kommentar