Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
For e.g. if Year selected as 2017 then the data shown will be : Jan 2017 to Sept 2017, same way if year selected as 2015 then the data shown will be : Jan 2015 to Sept 2015.(Dynamically)
Hi Try,
Note: The format defined in SET DateFormat and your date field format in Qlikview Table should be same, then only this expressions works.
Last 5 Years Sales
Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=YearStart(Max(Date), -4))<=$(=Date(Max(Date)))’}>} Sales )
Last 6 Quarters Sales
Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=QuarterStart(Max(Date), -5))<=$(=Date(Max(Date)))’}>} Sales )
Last 12 Months Sales
Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=MonthStart(Max(Date), -11))<=$(=Date(Max(Date)))’}>} Sales )
Last 15 Weeks Sales
Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=WeekStart(Max(Date), -14))<=$(=Date(Max(Date)))’}>} Sales )
Last 10 Days Sales
Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=Date(Max(Date)-9))<=$(=Date(Max(Date)))’}>} Sales )
Note:
YTD - Year to Date
QTD - Quarter to Date
MTD - Month to Date
WTD - Week to Date
Last YTD for the period selected
Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=YearStart(Max(Date), -1))<=$(=AddYears(Max(Date), -1))’}>} Sales)
Last QTD for the period selected
Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=QuarterStart(Max(Date), -1))<=$(=AddMonths(Max(Date), -3))’}>} Sales)
Last MTD for the period selected
Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=MonthStart(Max(Date), -1))<=$(=AddMonths(Max(Date), -1))’}>} Sales)
Last WTD for the period selected
Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=WeekStart(Max(Date), -1))<=$(=Date(Max(Date) -7))’}>} Sales)
You can go with Calendar (As Of month).
Please find attached qvw for same.
Try this in your expression
=Sum( {<Year = { ">=$(=Max(Year)) <=$(=Max(Year)-1)" } >} Val )
Hi,
Try like this.
YTD Sales
sum({$<Year={"$(=max(Year))"},Month={"<=$(=max(Month))"}>} Sales)
Earlier a typo this is right
=Sum( {<Year = { "<=$(=Max(Year)) >=$(=Max(Year)-1)" } >} Val )
sum({<Year={"$(=max(Year))"},Year=,Month=>}Sales)
if I want to MTD,QTD
how can I write the expression in this?