Forum Discussion
Previous week data based on selected week from slicer
- 6 years ago
Hi Anonymous ,
It is caused that the value is filtered by the slicer (Week = 27). You could try the following formula with the function of ALL. And you need to redefine the selected value in the measure.Because the measure of Previous Week to Selected Week is still affected by the slicer.
Last Week Distinct Apps = var a = SELECTEDVALUE(AllData[WeekNumber]) return CALCULATE(DISTINCTCOUNT(AllData[AppId]), FILTER(ALL(AllData), AllData[WeekNumber] = a-1))
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
It is caused that the value is filtered by the slicer (Week = 27). You could try the following formula with the function of ALL. And you need to redefine the selected value in the measure.Because the measure of Previous Week to Selected Week is still affected by the slicer.
Last Week Distinct Apps = var a = SELECTEDVALUE(AllData[WeekNumber]) return CALCULATE(DISTINCTCOUNT(AllData[AppId]), FILTER(ALL(AllData), AllData[WeekNumber] = a-1))
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
Hello v-xuding-msft and thank you millions for your interest and reply!
You are magnificent, you helped me a lot!
I was able to solve my issue by following your formulas and adding yet another filter.What I forgot to mention was that I had a global filter by the [Origin] of the app.
Therefore, using ALL function ignored this filter and returned the total unique values of last week.
This [Origin] column was in another table, so I related my AllData table with that column:
AllData[Origin] = RELATED(Application[Origin])
I figured I can add a second filter to the calculate function to keep that filter running.
And TA-DAAA, it gave me the previous week unique values filtered by origin :), like below:
Last Week Distinct Apps = var a = SELECTEDVALUE(AllData[WeekNumber]) return CALCULATE(DISTINCTCOUNT(AllData[AppId]), FILTER(ALL(AllData), AllData[WeekNumber] = a-1), FILTER(ALL(AllData), AllData[Origin] = "origin1")
Without your explanation, I would have been stuck forever!
So thank you so so so much!
Have great day,
Daniela
- Anonymous6 years agoNot applicable
How to handle end of year where week 52 becomes week 1