Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mattperry008
Frequent 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 of sales transactions and a date dimension. 

 

Can anyone hellp me with the DAX to create the "Sales Yesterday" column?

 

Many thanks,

Matt

 

Mock up below:

Capture.PNG

 

2 REPLIES 2
v-caliao-msft
Microsoft Employee
Microsoft 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])

Capture.PNG

 

Reference
https://msdn.microsoft.com/en-us/library/gg492170.aspx

 

Regards,

Charlie Liao

mattperry008
Frequent Visitor

Hi Everybody,

 

Still not having any luck with this one, so will try to give more info about issue. Have moved to the Contoso sample sales data from Microsoft, and still cant get it working.

 

What I need to do is display a column of sales from today and a column with sales from yesterday. 

 

The DAX I am using is Previous Quarter Sales = CALCULATE(SUM(Sales[SalesAmount]), PREVIOUSDAY(Calendar[DateKey]))

 

But when I drag the measure onto the visualisation, nothing appears for prev quarter sales.

 

Would appreciate any assistance - even pointers to good tutorials on time intelligence.

 

Many thanks,

Matt

 

Data:

http://download.microsoft.com/download/4/6/A/46AB5E74-50F6-4761-8EDB-5AE077FD603C/Contoso%20Sales%20...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors