Forum Discussion

Adam_8675309's avatar
Adam_8675309
New Member
8 years ago
Solved

Compare Snapshot data in one Table

Hello All,

 

I'm new to Power BI, and hoping to get some help on how to write DAX on Snapshot data I have.  I wasn't able to find anything yet, but I very well may be looking at it all wrong.  

 

Daily snapshots for Customer info would be as follows:

 

Customer     Preference     Date

XYZ              Vanilla           12/31/2017

XYZ              Vanilla            01/01/2018

XYZ              Chocolate      01/02/2018

XYZ              Chocolate      01/03/2018

 

There would be hundreds of thousands of rows for differnet cusotmers and dates, but what I would like to do is create a column at where it would compare the rows in the same table (above) and if it matched on Customer Number, Date minus one day (so the previous day/record), and then if the previous 'Preference' was different, it woudl show what the previous value was, else say Same.  Similar to this:

 

Customer     Preference     Date               Previous Preference

XYZ              Vanilla           12/31/2017     Same

XYZ              Vanilla            01/01/2018    Same

XYZ              Chocolate      01/02/2018    Vanilla

XYZ              Chocolate      01/03/2018    Same

 

Is that possible?  

 

Thank you for any help!