Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a situation where I have sales for at a daily level starting from Jan 2020 to date at an SKU level. I want to show in the chart the months and the sales against it. The only condition is that it should always be the next 30 days sales.
For example:
Jan ( 1st as nothing is selected)- Jan 30th : 2000
Feb(1st as nothing is selected)- Feb 29th :4000
and so on. As soon a user selects a day the bracket of 30 days should shift
The user selects 15 as a day:
Jan ( 15th)- Feb 15thth : 7000
Feb(15th)- Mar 16th :5000
In the below example I have selected 19th March but I get April (as the bracket is from 19th Mar - 19th Apr) also a month in the month which I don't want. I want the whole sum of 436932 in Mar bracket
I used the below set analysis
sum({<TRENDDATEMONTH={">$(=$(vL3MEndNew))<=$(=$(vRollingDays))"}>}[DAILY_SALES(Cases)])
vL3MEndNew: 19TH March
vRollingDays: 19th+30 days
Can it be done using set analysis or do I have to write it in script??
Hi, I'm not sure of what you want and what are you getting.
Maybe you need to if¡gnore selections in selected month so only set analysis applies?
sum({<TRENDDATEMONTH={">$(=$(vL3MEndNew))<=$(=$(vRollingDays))"}, MonthFieldToIgnore>}[DAILY_SALES(Cases)])
Also, I would try to make the variable to return the values I want to usetoa ovid the double $(, like setting the content of vRollingDays variable to: =$(vL3MEndNew)+30
If Ruben's post got you what you needed, please be sure to close the thread by using the Accept as Solution button on his post. This gives him credit for the help and lets other Members know it worked.
The only additional thing I have to try to help is the following Design Blog post:
https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table/ba-p/1466130
Regards,
Brett
Hi,
I suppose that you are using 'Month' as dimesion value, so I would add a calculated dimension and then I would create a single expression.
Dimension:
=aggr(only({<TRENDDATEMONTH={">$(=(vL3MEndNew))<=$(=(vRollingDays))"}>} YourMonthDimension),YourMonthDimension)
Expression:
=Sum(DAILY_SALES)
I normally use it like that. The difference is that in my case I always create a variable 'vRolling' and I use an input box to select the number of days, month, years that I want to select backwards or forwards.
Example considering the number of 'vRollingMonth' backwards "selected in an input box" from month(today)
=aggr(only({<DATE_OPERATION={">=$(=monthstart(today(),-vRollingMonth))<=$(=monthend(today()))"}>}ID),ID)
Hope that works for you.