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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
luke050
Frequent Visitor

Subtraction between yesterday's maximum and today's maximum.

I need a measure that will return the difference between yesterday's max and todays max

so this is my input:

table name: netusage

Zrzut ekranu 2020-11-20 163240.png

 

output example:

18.11.2020        no data - i dont care

19.11.2020        10300-10166 = 134

20.11.2020        10713-10300 = 413

 

tried something like that:

 

todays_maximum = 
CALCULATE(
MAX(netusage[Traffic]),
netusage[Date] = TODAY()
)

ysterdayss_maximum = 
CALCULATE(
MAX(netusage[Traffic]),
netusage[Date] = TODAY()-1
)

 

 

 

 

1 ACCEPTED SOLUTION

@luke050 

sorry, I didn't consider the time part. That will affect the result. I create a new date column and slightly change the DAX.

please see the attachment





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@luke050 

you can try to create a measure

    Measure = 
    VAR yesterday=maxx(FILTER(all(netusage),'netusage'[Date]=SELECTEDVALUE('netusage'[Date])-1),netusage[Traffic])
    return if(ISBLANK(yesterday),BLANK(),max(netusage[Traffic])-yesterday)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for the quick reply, I just tried it but the measure doesn't return any value, maybe I'm doing something wrong.

Zrzut ekranu 2020-11-20 171210.pngZrzut ekranu 2020-11-20 171334.png

@luke050 

sorry, I didn't consider the time part. That will affect the result. I create a new date column and slightly change the DAX.

please see the attachment





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.