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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.