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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Hoerben
Contributor
Contributor

SecondaryDimensionality in Pivot Table

Hello,

I use SecondaryDimensionality to calculate the variance between current year and prior year period.

My expression is the following:

=if(SecondaryDimensionality()<>1,
(sum({$<Year= {$(=Max(Year))},KPI= {'Sales'}>}Amount)- sum({$<Year= {$(=Max(Year)-1)},KPI= {'Sales'}>}Amount)),
sum({<KPI= {'Sales'}>}Amount))

I have to issues:

1.  If I do not select a specific year than prior year is calculated  as zero

2.  If I select a year than prior year is multiplied by -1

Regrettably I cannot find the solution for this. Maybe someone can help me how to adjust the expression.

BR,

Hoerben

 

Labels (2)
1 Reply
marcus_sommer

I think the expression is ok. but not the data-set or probably more likely the object. If you used such logic your object must not contain the Year as dimension respectively a field which includes the year like a YearMonth - with just only the Month it should be working.