Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Previous week data based on selected week from slicer

Hi guys,   I'm just learning the magic of PowerBi by building a weekly report. However, I got stuck and I really hope you guys can point me in the right direction.   Simply put, my table has a c...
  • v-xuding-msft's avatar
    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.