Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculated dimension

I have a pivot table which shows sales per several existing dimensions (ie customers, articles...), and I'm showing the selected and previous year's sales.

Now I want to create a calculted dimension which indicates if it's a new sale, an increased sale, a lost sale or decreasing sale. I've started to get the first one done, but I'm not able. I think that once that case cleared, I will find teh other cases out by myself...

I'm no using this formula as a calculated dimension:

=Aggr(If(Sum ({<Y= {$(=Max(Y))}>}[Sales])>=Sum ({<Y= {$(=Max(Y)-1)}>}[Sales]),

'New sale'),0)

13 Replies
vishsaggi
Champion III
Champion III

Did you create respective variables in your final file where you are copying into? Are the field names same with your example file and your original file?

Anonymous
Not applicable
Author

Yes I did. As a matter of fact, the formulas used in the expressions perfectly show the correct numbers...

This formula shows the Sum of [Venta Neta] related to the [Año 1] selected and depends if there is one first selected Origen:

If(subfield(GetFieldSelections(Origen,'||'),'||',1)='Real' or subfield(GetFieldSelections(Origen,'||'),'||',1) = 'Budget',

Sum ({<Y = {"$(=[Año 1])"}, Origen = {"$(=subfield(GetFieldSelections(Origen,'||'),'||',1))"}>}[Venta Neta]),

Sum ({<Origen = {"$(=subfield(GetFieldSelections(Origen,'||'),'||',1))"}>}[Venta Neta]))

This formula show teh Sum of [Venta Neta] related the [Año 2] selected and depends if there are one or two origens selected. Both formulas work perfectly...

If(Isnull(subfield(GetFieldSelections(Origen,'||'),'||',2)),

If(subfield(GetFieldSelections(Origen,'||'),'||',1)='Real' or subfield(GetFieldSelections(Origen,'||'),'||',1) = 'Budget',

Sum ({<Y = {"$(=[Año 2])"}, Origen = {"$(=subfield(GetFieldSelections(Origen,'||'),'||',1))"}>}[Venta Neta])),

If(subfield(GetFieldSelections(Origen,'||'),'||',2)='Real' or subfield(GetFieldSelections(Origen,'||'),'||',2) = 'Budget',

Sum ({<Y = {"$(=[Año 2])"}, Origen = {"$(=subfield(GetFieldSelections(Origen,'||'),'||',2))"}>}[Venta Neta]),

Sum ({<Origen = {"$(=subfield(GetFieldSelections(Origen,'||'),'||',1))"}>}[Venta Neta])))

Anonymous
Not applicable
Author

Vishwarath, I got it, I have a problem with vCritDimension!

vishsaggi
Champion III
Champion III

Cool.