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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
errepinna
Helper I
Helper I

Sum between specific values

Hello guys, I started to experiment with Power Bi yesterday. Got a lot to learn. Here's my problem:

 

Schermata 2020-09-24 alle 14.47.56.png

 

How do I add a column ∆ in a table from the Query Editor? The screen is from an Excel example I made.

1 ACCEPTED SOLUTION

@errepinna , something like this

 

new column =
var _last = maxx(filter(Table, [DATE] < earlier([DATE])),[DATE])
return
if(isblank(_last), blank(), [TotalMoney]- maxx(filter(Table, [DATE] =_last ),[TotalMoney]))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@errepinna , Try a new column like

new column =
var _last = maxx(filter(Table, [DATE] < earlier([DATE])),[DATE])
return
[TotalMoney]- maxx(filter(Table, [DATE] =_last ),[TotalMoney])

This works! Only one thing: the first raw displays the original value of [TotalMoney]. Is there a way to make it go to zero? I was thinking about putting a condition on the value of _last but I couldn't make it work.

@errepinna , something like this

 

new column =
var _last = maxx(filter(Table, [DATE] < earlier([DATE])),[DATE])
return
if(isblank(_last), blank(), [TotalMoney]- maxx(filter(Table, [DATE] =_last ),[TotalMoney]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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