Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
eddywong71
Creator
Creator

How to extract last month's value for every Quarter

Hi All,

Same as below link.

https://community.qlik.com/t5/App-Development/How-to-extract-last-month-s-value-for-every-Quarter/td...

I want to create a line Chart only Show  Q1 = Mar2023  Q2 = Jun2023, Q3 =Sep2023, Q4 = Dec2023 just like below 

eddywong71_0-1692156655264.png

By using 

Dimension:

Dual('Q'&Num(Ceil(Num(Month(InvDate))/3)),Num(Ceil(NUM(Month(InvDate))/3),00))

Measure:

Sum({<InvId = {'=Month(InvDate)=Month(QuarterEnd(InvDate))'}>}Sales)

OR

Sum(If(Month(InvDate)=Month(QuarterEnd(InvDate)),Sales,0)).

 

However The Line Chart sum with all the year. I want the Line chart have two line

Current Year , Last Year. like below picture

eddywong71_0-1692171064184.png

 

 

how should i revise the measure.

Can anyone help?

 

1 Reply
Lakshmanan
Partner - Contributor III
Partner - Contributor III

Hi , 
Create two different measures for Current year and previous year and add them in measures .
SUM({$<Year={'$(=Year(Today()))'}>} Sales)   // sales for current Year
SUM({$<Year={'$(=Year(Today())-1)'}>} Sales) // sales for previous Year