Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have defined as Time Dimensions as below:
Date defined as vTimeDim = 1,
Week defined as vTimeDim = 2,
Month defined as vTimeDim = 3,
Year defined as vTimeDim = 4. vTimeDim is the action given to the text Objects so that user can toggle between the different time dimensions.
And I have expression as
pick(vTimeDim,
sum({<Link_Date={'$(vToDate)'}>}Applications,
sum({<Link_Date={">=$(=DATE(weekstart(vToDate)))<=$(vToDate)"}>}Applications,
sum({<Link_Date={">=$(=DATE(monthstart(vToDate)))<=$(vToDate)"}>}Applications,
sum({<Link_Date={">=$(=DATE(yearstart(vToDate)))<=$(vToDate)"}>}Applications)
Is there a way to variablize the date modifier, so that I can write just one expression.
Something like =sum({<$(vTimeSetExp)>}Applications.
I'm not sure how to put the date modifiers into vTimeSetExp
Thanks for all the help in advance.
How about this:
Sum({<Link_Date = {"$(=Pick(vTimeDim, '$(vToDate)', >=$(=Date(WeekStart(vToDate)))<=$(vToDate), >=$(=Date(MonthStart(vToDate)))<=$(vToDate), >=$(=Date(YearStart(vToDate)))<=$(vToDate))"}>}Applications)
Sunny, Appreciate your quick and prompt response.
Is there a way to completely get rid of Link_Date = {"$(=Pick(vTimeDim, '$(vToDate)', >=$(=Date(WeekStart(vToDate)))<=$(vToDate),>=$(=Date(MonthStart(vToDate)))<=$(vToDate), >=$(=Date(YearStart(vToDate)))<=$(vToDate))"} this par.
I mean can we replace it with a variable. Because I have about 50 metrics and I'll have to write this part for all of them right.
See if you like the approach in the attached qvw file. I can provide another one based on a variable, but this one uses a technique from an inline load in the script.
Hi aditya,
You can use variable functions to create a variable Set Analysis. See this post:
https://community.qlikview.com/thread/18030
For example:
Your variable: ='{<Link_Date={">=$(=DATE('&$1&'(vToDate)))<=$(vToDate)"}>}'
Your expression: sum($(YourVarName('weekstart'))Applications)
Regards!!