Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
YTD,QTD,MTD,WTD IN Qlik Sense
I have the same problem in sense. I am trying to compare two kpi's. I'd like to switch between ytd, qtd, mtd and wtd. I was very happy when i found this piece of code, but i still wasn't able to fix the problem in my app. So let's pretend i want to have mtd.
Sum({<Year,Quarter,Month,Week, OrderDate = {"$(='>=' & Date(MonthStart(Max(OrderDate)), 'YourDateFieldFormatHere') & '<=' & Date(Max(OrderDate), 'YourDateFieldFormatHere'))"}>} Sales)
cehck your Datum format
If(DateTemp1 = 'YTD', Sum({<type={'Order'},Year,Quarter,Month,Week, Datum = {"$(='>=' & Date(YearStart(Max(Datum ),-1), 'DD/MM/YYYY') & '<=' & Date(Max(Datum )-1, 'DD/MM/YYYY'))"}>} Sales)
YourDateFieldFormat means 'DD/MM/YYYY'
check the Datum format in filter
cehck your Datum format
If(DateTemp1 = 'YTD', Sum({<type={'Order'},Year,Quarter,Month,Week, Datum = {"$(='>=' & Date(YearStart(Max(Datum ),-1), 'DD/MM/YYYY') & '<=' & Date(Max(Datum )-1, 'DD/MM/YYYY'))"}>} Sales)
YourDateFieldFormat means 'DD/MM/YYYY'
check the Datum format in filter