Forum Discussion

MrHajiCoolBreez's avatar
MrHajiCoolBreez
Frequent Visitor
1 year ago
Solved

Getting the Previous Value in a Matrix with 7 rows

I have a Matrix which looks like this

 

I have 7 Columns in ROWS
"EndOfSnapShotWeek" in the COLUMNS
and "Rev1" and "Rev2" in the VALUES

I want to create two measures that will calculate whether the "Rev1" or "Rev2" VALUES has gone up/down compared to the previous week (EndOfSnapShotWeek column.).
Then I can use that in conditional formatting.
I can handle the conditional formatting I just need help with the DAX.

Sample PBIX file is attached here
Sample PBIX 

  • lbendlin's avatar
    lbendlin
    1 year ago

    You have interesting data including negative numbers. Calculating a WoW with a mix of positive and negative numbers is extremely subjective.  Make sure you agree with the formula.

     

    Here's my (subjective) version:

     

     

    Rev1 change = 
    var pr1 = CALCULATE(sum(test[Rev1]),DATEADD('Calendar'[Date],-7,DAY))
    return divide(sum(test[Rev1])-pr1,abs(pr1),1)

     

     

     

    However your x axis is driven by a fact date (end of snapshot week) and not by the dimension date as it should be . You will want to correct that too ( or modify the above formula)

     

     

     

10 Replies