Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to use set analysis to calculate the different in KPI between current/selected month and the previous month.
For e.g. if July 2023 is selected in the Date Filter, the KPI visual should display the total sales and the difference of Sum of July 2023 sales and June 2023 sales.
Thank you, Anat, for sharing the link. I figured out what I wanted. I used the expression below.
(Sum({<Date = {">=$(=MonthStart(Max(Date)))<=$(=MonthEnd(Max(Date)))"}>}Amount) -
Sum({<Date = {">=$(=MonthStart(AddMonths(Max(Date), -1)))<=$(=MonthEnd(AddMonths(Max(Date), -1)))"}>}Amount))
The dashboard includes a month filter as well. When there are no selections, it should give me the value for the sum of the current month's amount minus the sum of the previous month's amount. Bad it gives nulls when a selection is made.
I made a small modification in the identifier and that fixed the issue.
(Sum(1{<Date = {">=$(=MonthStart(Max(Date)))<=$(=MonthEnd(Max(Date)))"}>}Amount) -
Sum({1<Date = {">=$(=MonthStart(AddMonths(Max(Date), -1)))<=$(=MonthEnd(AddMonths(Max(Date), -1)))"}>}Amount))
Now I can see the difference in the sum of amount between the selected month and its previous month.
here is the wonderful material for MoM and YoY calculation.
https://community.qlik.com/t5/QlikView-Documents/YTQ-QTD-MTD-and-WTD/ta-p/1489245
Thank you, Anat, for sharing the link. I figured out what I wanted. I used the expression below.
(Sum({<Date = {">=$(=MonthStart(Max(Date)))<=$(=MonthEnd(Max(Date)))"}>}Amount) -
Sum({<Date = {">=$(=MonthStart(AddMonths(Max(Date), -1)))<=$(=MonthEnd(AddMonths(Max(Date), -1)))"}>}Amount))
The dashboard includes a month filter as well. When there are no selections, it should give me the value for the sum of the current month's amount minus the sum of the previous month's amount. Bad it gives nulls when a selection is made.
I made a small modification in the identifier and that fixed the issue.
(Sum(1{<Date = {">=$(=MonthStart(Max(Date)))<=$(=MonthEnd(Max(Date)))"}>}Amount) -
Sum({1<Date = {">=$(=MonthStart(AddMonths(Max(Date), -1)))<=$(=MonthEnd(AddMonths(Max(Date), -1)))"}>}Amount))
Now I can see the difference in the sum of amount between the selected month and its previous month.