Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
delporte_marcel
Partner - Contributor II
Partner - Contributor II

Trying to compare two kpi's; switch between ytd, qtd, mtd and wtd

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)

  • I switched OrderDate to Datum because that is the date i am refering to
  • What means 'YourDateFieldFormat'? After OrderDate = there is no syntax highlightnig, i have no idea.
1 Solution

Accepted Solutions
arulsettu
Master III
Master III

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

View solution in original post

1 Reply
arulsettu
Master III
Master III

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