Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I need two buttons for MTD and YTD in Qliksense, if i select MTD the data in the dashboard should be filtered for MTD. if i select YTD, the data should be filtered for YTD.
Could you please help me with the expressions for YTD and MTD.
Thanks in Advance.
i mean the logic which has to be written on the MTD button
OK, I get it, so maybe like this ?
Pic 1 : by clicking on YTD :
Pic 2 : by clicking on MTD :
If yes, then you need this in your button formulas :
YTD : ='>=$(=YearStart(Max(Date)))<=$(=Max(Date))'
MTD : ='>=$(=MonthStart(Max(Date)))<=$(=Max(Date))'
With action : Select values matching criteria
Best regards,
Antoine L
Hi Sir,
Thanks a million for your help Sir, the MTD logic that you gave is filtering 1 to 16, but what i would need is
if i click MTD button, it should filter for Feb 1 to Feb 16 2024.
Could you please help me sir
Yes, that is exactly what I've done, as you can see in the table below the button
The button would just set a variable, no?
You can define a variable called vMtdYtd and initialize in your load script
SET vMtdYtd='<=$(=date_col)>=$(=MonthStart(date_col))' // Initialized for MTD
In the MTD button, you would set the variable to
'<=$(=date_col)>=$(=MonthStart(date_col))'
In the YTD button, you would set the variable to
'<=$(=date_col)>=$(=YearStart(date_col))'
Your pivot table expressions would look like:
sum({1<date_col= {'$(vMtdYtd)'}> } sales)