Forum Discussion
mattperry008
10 years agoFrequent Visitor
PreviousDay comparison
HI All, I'm trying to make a simple report that is sorted by category, then subcategory showing sales today and sales yesterday. A slicer is used to select the date. Working from a table...
v-caliao-msft
10 years agoMicrosoft Employee
Hi Mattperry008,
According to your description, you need to add a column to display yesterday's sales amount, right?
If that is the case, you can add a calculated column to get the sales amount of yesterday. I have tested it on my loca environment, here is sample DAX expression for you reference.
PreviousDay = DATEADD('PreviousDay'[Date],-1,DAY)
PreviousDaySales = LOOKUPVALUE('PreviousDay'[Sales],'PreviousDay'[Category],'PreviousDay'[Category],'PreviousDay'[Subcategory],'PreviousDay'[Subcategory],'PreviousDay'[Date],'PreviousDay'[PreviousDay])
Reference
https://msdn.microsoft.com/en-us/library/gg492170.aspx
Regards,
Charlie Liao