Reply
majdkaid22
Helper V
Helper V

calculate Daily Change Delta

Hi Community,

 

am trying to get the Delta value (Daily change) of a column in my db.

 

The following Formula 

Floating Profit_USD Delta = 'live_daily'[Floating Profit_USD] - CALCULATE(SUM('live_daily'[Floating Profit_USD]), 'live_daily'[TIME]=EARLIER('live_daily'[TIME])-1)

is working fine when it's week days, but when when it's Friday to Monday, am getting the value incorrect. as seen in the highlighted cell below

 

 

 

PBI.PNG

I understand this is because of the -1 at the end, but I cannot figure out how to put "LASTDAY" or LASTNONBLANK into this statement, so the calculate take on the lastnonblank day

 

Appreciate if somebody can assist on the formula 

 

 

Thanks,

 

 

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @majdkaid22,

 

In Query Editor mode, sort the [TIME] column in ascend sequence, then, add an index column. Then, modify above formula to:

Floating Profit_USD Delta = 'live_daily'[Floating Profit_USD] - CALCULATE(SUM('live_daily'[Floating Profit_USD]), 'live_daily'[Index]=EARLIER('live_daily'[Index])-1)

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @majdkaid22,

 

In Query Editor mode, sort the [TIME] column in ascend sequence, then, add an index column. Then, modify above formula to:

Floating Profit_USD Delta = 'live_daily'[Floating Profit_USD] - CALCULATE(SUM('live_daily'[Floating Profit_USD]), 'live_daily'[Index]=EARLIER('live_daily'[Index])-1)

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello

 

I try to do it with my table but i have an error. (A single value for column 'Parc' in table cannot be determined...)

If i put a "SUM" before 'Delta Parc Fibre'[Parc], i have an error on earlier who doesn't exist (i suppose it is the problem for the first row ?)

 

My measure :

'Delta Parc Fibre'[Parc] - CALCULATE(sum('Delta Parc Fibre'[Parc]); 'Delta Parc Fibre'[index Semaine]=EARLIER('Delta Parc Fibre'[index Semaine] )-1)

 

My table :

 

table.JPG

 

index Semaine is modeling as a whole number.

 

What do i made wrong ?

 

Bruno

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)