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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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