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
Anonymous
Not applicable

Comparing Today's data at current time VS Yesterday's data up to this time

I have timestamps for some of my data in the format of mm/dd/yyyy hh:mm:ss and would like to use these timestamps to compare the data from Today and Yesterday. I am measuring data of production and want to show, if it is 10am today, what is the data for today(midnight to 10am) vs yesterday(midnight to 10am). Is this something that is possible in power bi? I have the measures for today and yesterday values shown below

Today Products Made= if(ISBLANK(CALCULATE(SUM('# Products'[Count(Products)]),'# Products'[Date] = TODAY())), 0, CALCULATE(SUM('# Products'[Count(Products)]),'# Products'[Date]=TODAY()))

 

Yesterday Products Made= if(ISBLANK(CALCULATE(SUM('# Products'[Count(Products)]),'# Products'[Date] = TODAY()-1)), 0, CALCULATE(SUM('# Products'[Count(Products)]),'# Products'[Date]=TODAY()-1))

 

Could someome please help with the query to include the current time today and match it with data from yesterday before the same time?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Found a solution to this problem. 

I had to create 4 new columns:

1) Yesterday's Value = IF('# Products'[TimeStamp] = TODAY()-1, 1, 0)
2) Before Current Time = IF('# Products'[TimeStamp] <= NOW()-1, 1, 0)
3) Duplicated the timestamp column and transformed it to "Hour"
4) Previous Day = IF(AND([Yesterday's Value] = 1, [Before Current Time] = 1), 1, 0)
 
Now I can just sum the Previous Day column in a new measure. 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Found a solution to this problem. 

I had to create 4 new columns:

1) Yesterday's Value = IF('# Products'[TimeStamp] = TODAY()-1, 1, 0)
2) Before Current Time = IF('# Products'[TimeStamp] <= NOW()-1, 1, 0)
3) Duplicated the timestamp column and transformed it to "Hour"
4) Previous Day = IF(AND([Yesterday's Value] = 1, [Before Current Time] = 1), 1, 0)
 
Now I can just sum the Previous Day column in a new measure. 

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