Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello QlikCommunity,
We have KPI to show difference between Current quarter and Previous quarter.
The expression for KPI
"sum({<QuarterYearNum={"$(=max(QuarterYearNum))"}>}[Units])
-
sum({1<QuarterYearNum={"$(=max(QuarterYearNum)-1)"}>}[Units])"
If I select any filter "company or Business area or Country" then it's not comparing with the selected filter's previous quarter value, instead it is taking total previous quarters value with the selected current quarters filter value.
example:
Current quarter value for selected filter:100
Previous quarter value for selected filter:80
Total Previous Quarter value : 500
KPI Should be:20
but it is showing:400
Where is miss the logic........
Please help me out.
I got solution
I have exclude the "quarteryear" selection
sum({<QuarterYearNum={"$(=max(QuarterYearNum))"}>}[Units])
-
sum({1<QuarterYearNum={"$(=max(QuarterYearNum)-1)",Quarteryear= }>}[Units])"
Pls try This:
= sum({$<QuarterYearNum={"$(=max(QuarterYearNum))"}>}[Sales]) -
sum({$<QuarterYearNum={"$(=max(QuarterYearNum)-1)"}>}[Sales])
'$' - in Set expressions takes current selections
'1' - in set expressions takes entirety. i.e ignores any selections made
Hi Krishna,
Thanks for your response. If I remove '1' from the set expression, then it takes only previous quarter value not showing the difference between current quarter and previous quarter.
Ex: The current quarter is Q3.If we click on Q2(any previous quarter), then it is showing only Q2 value instead of difference.
Try this expression:
= sum({$<QuarterYearNum={"$(=max(QuarterYearNum))"}>}[Sales]) -
sum({$<QuarterYearNum={"$(=max(QuarterYearNum)-1)"}>}[Sales])
Ex: The current quarter is Q3.If we click on Q2(any previous quarter), then it is showing only Q2 value instead of difference.
When you have max(QuarterYearNum) in the expression, it calculates the max value for QuarterYearNum, no matter what quarter you slect
if you want more clearer solution, pls provide a mock up data.
Hi Krishna,
Thanks for response. I got solution.
I got solution
I have exclude the "quarteryear" selection
sum({<QuarterYearNum={"$(=max(QuarterYearNum))"}>}[Units])
-
sum({1<QuarterYearNum={"$(=max(QuarterYearNum)-1)",Quarteryear= }>}[Units])"