Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Lakshmanudui
Contributor II
Contributor II

How to find current month and Previous Month difference in January Month

Hi All,

I have 3 years data and always showing current years data.

I have Mon-Year field and in that having values like Jan-23,Feb-23, Mar-23 like that

I have created a pivot table, in which I have taken Product_Id and product_name and Mon-Year as dimensions.

I want to See the difference in sales between the current month and the previous months in all months.

For this, I created the set analysis below.

If (Columnno()=1,

(Sum({<Year={"$(vMaxYear)"},Month={"$(vMinMonth)"}>}Sales)-Sum({<Year={"$(vPreviousYear)"},Month="$(vMax_PreviousMonth)"}>}Sales)),

(Sum({<Year={"$(vMaxYear)"}>}Sales)-Before(Sum({<Year={"$(vMaxYear)"}>}Sales))))

here vMinMonth = Min(Month)

vMax_PreviousMonth=Min(Month)-1 --> It is always get Dec of 2022

In the above set analysis, I am able to obtain correct data from fed to Jun, but not Jan.

always my current selection is 2023.

Can you please suggest me how to get this Scenario.

Thanks & Regards,

lakshman

 

Labels (3)
2 Replies
G3S
Creator III
Creator III

Rams-
Creator
Creator

Hi,

You can use this function for previous month

vMax_PreviousMonth=AddMonths(max(Month),-1)

 

 

Hope this helps,

help user find answers ! don't forget to mark  a solution that work for you and click the like button!