Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
dushan1987
Contributor II
Contributor II

LYMTD using Year, Month and day

Hi,

I want to create Last year Month to Date (LYMTD) using Year, Month and day fields. Please help on this

My expression to LYTM is follows.

Count({$<Main_Year={$(=Max(Main_Year)-1)},Main_Month={"<=$(=Max({<Main_Year={$(=Max(Main_Year))}>}Main_Month))>$(=Max({<Main_Year={$(=Max(Main_Year))}>}Main_Month)-1)"}>}Ref_No)

How can I change this to LYMTD and THMTD?

4 Replies
PauloHSantos
Contributor
Contributor

you have to pass the field wich the date three times, on charge using the functions Day, Month and Year 


Ex:

 Day("Data_Plano") as dia,
Month("Data_Plano") as mes,
Year("Data_Plano") as ano,

OmarBenSalem

try sthing like this:

sum({<Year={"$(=max(Year)-1)"},Month={"<=$(=addMonths(max(Month),-12))"},Day={"<=$(=max(Day))"}>}Value)

dushan1987
Contributor II
Contributor II
Author

Hi this is not working. 

My expression to LYTM is follows and it is working correctly. Can I change this to LYMTD?

Count({$<Main_Year={$(=Max(Main_Year)-1)},Main_Month={"<=$(=Max({<Main_Year={$(=Max(Main_Year))}>}Main_Month))>$(=Max({<Main_Year={$(=Max(Main_Year))}>}Main_Month)-1)"}>}Ref_No)

dushan1987
Contributor II
Contributor II
Author

Hi,

Can anyone help on this.