Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Sassou781221
Contributor II
Contributor II

Previous month Data comparaison

Hi Qlik Crew ! 

I'm trying to compaire between A month data and it's previous month's data 

But I'm getting the data of the current month 

ex : for August I get the same data for M and M-1 whitch is M data (look the table on the bottom) 

theese are the expressions I used : 

CA Reel : Sum(Distinct CA_Reel)

Ca Reel M-1 : Sum(DISTINCT{$<MonthYear={"=$(=AddMonths(Max(MonthYear),-1))"}>}CA_Reel)-Sum(Distinct CA_Reel)

Previous_Month(dimension) : =Date(AddMonths(MonthYear,-1),'MM/YYYY')

Sassou781221_0-1617210910586.png

Regards, 

A.

1 Reply
mato32188
Specialist
Specialist

Hi Sassou,

try to use rangesum(above(Sum(Distinct CA_Reel),0,NoOfRows())). You cannot reference to previous month in set analysis in your sample using straight/pivot table. 

If solution above is not suitable for you, I would rather calculate measures in script or there is one more option using As Of Table approach (https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table/ba-p/1466130).

BR

m

ECG line chart is the most important visualization in your life.