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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.