Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
pankaj999
Contributor III
Contributor III

Dynamic Last Month of Current Quarter

Hi,

I need to calculate sales for the current and last month of the current quarter. Now if we are on the first month then it should not calculate anything for the last months as its the first month of the quarter.

I tried this but it doesn't work:

sum({<Month={"=$(=Max(Month))"}>} sales)   // current month 

sum({<Month={"=$(=Max(Month)-1)"}>} sales) // previous month

 

 

 

 

 

2 Replies
shiveshsingh
Master
Master

Hi

 

You need to put a condition in set expression to get the current quarter too.

 

Like Quarter = {"$(=max(Quarter))"}

Shubham_Deshmukh
Specialist
Specialist

Don't know about exact requirement but it will you last month of current quarter and check whether it is first month of current quarter or not. If it is not first month then it will give you last month of CQ.

=Sum(if(monthname(today())<>monthname(QuarterStart(Today())), MonthName(QuarterEnd(today())),sale))

 

Hope it helps.

-Shubham