Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Year, Quarter, Month and Week To Date are the common analysis that I seen many applications. I will share the expression to do here
First to do this your data model should have the DateField in number format by applying floor
Similar to this
Floor(DateField) AS DateNum //it will gives you one whole number to represent date
YTD - Year To Date
A date should be selected and it will look for the Starting date of the year to the selected date.
Ex: date selected is 21-03-2014 then YTD is 01-01-2014 to 21-03-2014
Expression would be
Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=$(=Num(YearStart(Max(DateNum))))<=$(=Max(DateNum))"}>} Sales)
QTD- Quarter to Date
In the place of year use Quarter
Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=$(=Num(QuarterStart(Max(DateNum))))<=$(=Max(DateNum))"}>} Sales)
MTD- Month to Date
Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=$(=Num(MonthStart(Max(DateNum))))<=$(=Max(DateNum))"}>} Sales)
WTD- Week to Date
Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=$(=Num(WeekStart(Max(DateNum))))<=$(=Max(DateNum))"}>} Sales)
if you want you can set a variable value as 'Year', 'Month', 'Quarter', 'Week', lets say vToDate and go with single chart and single expression
Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=$(=Num($(=vToDate& 'Start(Max(DateNum))')))<=$(=Max(DateNum))"}>} Sales)
Will keep your expression simple
Regards,
Celambarasan
Hi
You can achieve this
Refer this
Also good thing about qlik is you can use the expressions in same Qlik doc or in a different Qlik document from external source.
Refer the below link
Excellent!! I was missing the $ sign before the variable! that do the trick!
thanks!
Excellent Work Celambarasan. good job!!
how is the expression done for Qlik Sense i am total new beginner and i need an expression for
order_date.autocalendar.yearmonth january 2015 to Febuary 2015
but i dont know where to add in the example expression below
sum({$<[Order_Day.autoCalendar.YearMonth] = {'$(=date(max([Order_Day.autoCalendar.YearMonth]), 'YYYY-MMM'))'}>} [DPO_Data.Amount])
Hi
As a beginner I didn't understand
How Year=, Month=, Quarter=, Week=, DateField=
this works.
Can any one explain?
Its like telling not to consider the selections applied for Year, Month, Quarter, Week, DateField.
Cheers,
Naresh
thank you guntur
If I select Year=, Month=, Quarter=, Week=, DateField=
Values are changing .
Hi All
Is there a way to default a selection to a date so when a user opens a dashboard the KPIs having meaning?
Best, Paul
Good Work
Thank's for sharing
Saludos,
Enrique