Skip to main content
Announcements
See why Qlik was named a Leader in the 2025 Gartner® Magic Quadrant™ for Augmented Data Quality Solutions: GET THE REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
Amit_B
Creator II

Comparison between months using set analysis

Hi everyone,

I need to create a line chart that compares each month to its previous month.
The dimension is Year-Month (format: YYYY-MM).
The metric should be the quantity of the month compared to the quantity of its previous month. There is a master measure called CountX that can be used.

For example:
The model is filtered for the year 2025.
CountX for February 2025 is 100, for January 2025 is 80, and for December 2024 is 95.
Then in January 2025 I should see -15 (80-95), and in February 2025 I should see 20 (100-80).

I tried using the Above function, but I am not getting data for January 2025, probably because December 2024 doesn't meet the filter criteria.
I couldn't solve it using set analysis.

I would appreciate any help.
Thanks!

Labels (3)
3 Replies
ramchalla
Creator II

Hi Amit,

You can use the below expression. Please check if this helps.

Sum({<YearMonth>}Sales)-Below(Sum({<YearMonth>}Sales))

you can replace Sum with Count and Sales with Quantity based on your requirement.

Amit_B
Creator II
Author

I tried to do it.
For Above I am not getting data for March 2025.
For Below I am not getting data for January 2025.

ramchalla
Creator II

Hi Amit,

Can you please let me know the value should be displayed for the last month? Based on the below function, we will not get any value for the last month. Should it be the same value for the last month?

And if possible, can you please help me with the sample data?