Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
ARUNKRISHNAN
Contributor
Contributor

how to calculate YTD and MTD for year april 2022 to march 2023

i want the set analysis expression for YTD aand MTD for year april 2022 to march 2023

Labels (2)
1 Reply
sk88024
Creator
Creator

Set variables as 

vDate_1 =Date('01/04/2022', 'DD/MM/YYYY')

vDate_2 =Date('31/03/2023', 'DD/MM/YYYY')

 

YTD expression:

=Sum({<Date={">=$(vDate_1) <=$(vDate_2)"}>}Sales)

 

MTD expression (eg: for Month of March 2023)

=Sum({<Date={">=$(=MonthStart(vDate_2)) <=$(=MonthEnd(vDate_2))"}>}Sales)

 

General expression for YTD and MTD:

YTD

Sum( { < OrderDate = {" >=$(=YearStart(Today())) <=$(=Today()) "} >} Sales)

MTD

Sum({ < OrderDate = {" >=$(=MonthStart(Today())) <=$(=Today()) "} >} Sales)