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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
CJVE
New Member

Calculate Difference of a balance for a "user" between dates.

Hi all! 

Please see below picture. So I guess my problem is kinda straight forward but can't find the answer.
I might be searching for the wrong terms. Apologies. 

Anyhow. As you can see below the first column "link" is a unique "User" (lets say) and the User has a balance in the last column "Claimed Essence". This balance increases for everyday as can see with the "DATE" and "Claimed Essence" Value. 
I have managed to derive a calculated column for the "previous date" for the balance value (not sure if I need it). 

What I want to do is to calculate the DIFFERENCE (The increased value) between the balance at the previous date for this "LINK" vs the DATE to get the (new) "INCREASED VALUE" that is the "added" value to the balance. 
What would the formula be for that calculated column "INCREASED VALUE"?
CJVE_0-1644437654349.png

Exmaple outcome: 
Row 2 (from top) would say: 2    (844-842 = 2)
Row 3 (from top) would say: 8 (852-844 =8 )

All fields are in the same data table just like visualized but there are many different unique "links".
Each Unique "link" only appears once on every date with its own balance.  Hence granularity of the table is per "link" per "date".
See it like "accounts" at a bank with increased "balance" for each day and the question is to calc the added value with a calculated column. 

Thanks a lot guys!

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @CJVE ,

 

Please try:

INCREASED VALUE = 
var _previous= LOOKUPVALUE('Table'[Claimed Essence],'Table'[Date],[PreviousEssenceYieldDate])
return  IF(_previous=BLANK(),BLANK(), [Claimed Essence]-_previous)

Eyelyn9_0-1644817947680.png

 

Best Regards,
Eyelyn Qin
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-eqin-msft
Community Support
Community Support

Hi @CJVE ,

 

Please try:

INCREASED VALUE = 
var _previous= LOOKUPVALUE('Table'[Claimed Essence],'Table'[Date],[PreviousEssenceYieldDate])
return  IF(_previous=BLANK(),BLANK(), [Claimed Essence]-_previous)

Eyelyn9_0-1644817947680.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Please show the expected outcome.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.