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: 
Kat92
Contributor III
Contributor III

Current vs Previous Month in Bar Chart

Hi,

 

I would like to show in a barchart the current and same month last year and want to display all the months available no matter if the Date filter is selected.

So, far I have managed to create the below measures

Current Year months=Sum({<Date={">=$(vStartYear) <=$(vCurrentDate)"}>} Actual)

Past Year Months=Sum({<Date={">=$(vPreviousStartYear) <=$(vPreviousCurrentDate)"}>} Actual)

But in this way I can not display the values next to each other. The variables created are calculating correctly the dates I want to show and according to the names. Please let me know if it is not clear though.

Could you please assist?

 

Labels (4)
2 Replies
Javizh
Partner - Contributor III
Partner - Contributor III

Hello @Kat92 

Maybe the problem is not the formula, but the dimension you are using in the bar chart.

Which dimension are you using? Maybe you are using a YearMonth dimension which will automatically report them separately.

I would recommend you to use the  dimension "Month" as Month(Date).

Best regards

 

Kat92
Contributor III
Contributor III
Author

Hi again,

Thanks for your input, I had tried with different dimensions all from the same Calendar table. I did use a different approach and calculated the Past results with the help of above function

Current ={<Date= >} sum({<Date= >} Actual)

Past={<Date= >} (above(sum({<Date= >} [Actual]),12,3))

Now results are correct and shown as expected. 

However I want to exclude values prior to 2023 from my chart and it seems to be challenging as well.

No matter what I try it either show only the current or shows all available dates