Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Previous week comparison calculation based on Slicer date calculation

Start of the week will be Monday.
Previous week comparison calculation based on Slicer date calculation
Comparison = (Current week Sales  - Previous week Sales) / Previous week Sales

 

Please find below screenshot :

 

  • Hi, Anonymous 

     

    You can try the following methods.

    Sample data:

    Measure:

    Current week Sales = CALCULATE(SUM('Table'[Value]),ALLEXCEPT('Date','Date'[Week]))
    Previous week Sales = CALCULATE(SUM('Table'[Value]),FILTER(ALLEXCEPT('Date','Date'[Week]),WEEKNUM([Date],2)=WEEKNUM(SELECTEDVALUE('Table'[Date]),2)-1))
    Comparison = DIVIDE([Current week Sales]-[Previous week Sales],[Previous week Sales])

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

     

    You can try the following methods.

    Sample data:

    Measure:

    Current week Sales = CALCULATE(SUM('Table'[Value]),ALLEXCEPT('Date','Date'[Week]))
    Previous week Sales = CALCULATE(SUM('Table'[Value]),FILTER(ALLEXCEPT('Date','Date'[Week]),WEEKNUM([Date],2)=WEEKNUM(SELECTEDVALUE('Table'[Date]),2)-1))
    Comparison = DIVIDE([Current week Sales]-[Previous week Sales],[Previous week Sales])

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.