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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
gescobarmaya
Frequent Visitor

Difference between today values (granulated by minutes) and the last or max of yesterday´s values

Hi everyone,

I´ve been trying to get the difference between the current (today) values that are granulated by minutes, and the last or max of yesterday´s value. I tried this with no results:

 

VALUE_Dif D-1 =
var _Max=Max(DataTable[Value])
var ValueD_1= CALCULATE(_Max, DATEADD(TableDate[Date], -1, DAY))
return
[VALUE]-ValueD_1
 
[Value] is the average of the DataTable[Value] to avoid summarize 
 
Does someone know what´s is missing? 
 
2021-02-18 (2).png

 

 

5 REPLIES 5
jameszhang0805
Resolver IV
Resolver IV

hi would you please try this.  change the caclulate expression in var ValueD_1 from a variable to Max(DataTable[Value])

Thank you James, but I tried before and I can't introduce the MAX function in CALCULATE.  

This message appears me when I try to do that: "A function 'MAX' has been used in a True/False expression that is used as a table filter expression. This is not allowed."

use topn function to calculate the max value table and put it into calculate filter. the calculate expression. please change to values(DataTable[Value)

Diff Testing 
Added the pbix file , please check 

Nope. There is the thing. Like I said, the values are granulated by minutes. I´m not able to bring the last value of D-1 to today´s values to calculate the difference. My D-1 calc is only bringing me the value for the same hour that the day before 😅, and I need it for every value for any time of the current day.2021-02-18 (2).png

 The time of every value is only for demonstrative purposes and it changes every day.

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors