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
VilmarSch
Post Partisan
Post Partisan

Do Not Consider If Accumulated Value Is Negative

How to do this calculation in Power BI?

 

Captura de tela 2024-04-15 221324.png

 

Mes	Valor1	Valor2
1	640,57	543,65
2	1.291,28	456,18
3	447,82	572,50
4	503,29	616,34
5	288,60	535,83
6	214,16	1.048,19
7	1.034,12	463,47
8	467,98	1.370,22
9	1.646,51	1.998,95
10	1.008,39	862,96
11	1.126,45	2.018,41
12	535,58	815,62

 

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @VilmarSch 

This is an interesting topic.  This kind of calculation referencing previous rows seems easier in Excel than in Power Pivot, but I am sure that there are many ways to achive this this in Power Pivot/ Power BI, too.  For example, you can create helper columns in calculated columns to get the result you want.

DataNinja777_0-1713322889890.png

DataNinja777_1-1713322939267.png

 

DataNinja777_2-1713323026574.png

DataNinja777_3-1713323047215.png

I am sure that there are more elegant ways to achive your required output in one calculated column instead of the 3 columns approach above, but your required output is achived in this manner, too.   

View solution in original post

2 REPLIES 2
DataNinja777
Super User
Super User

Hi @VilmarSch 

This is an interesting topic.  This kind of calculation referencing previous rows seems easier in Excel than in Power Pivot, but I am sure that there are many ways to achive this this in Power Pivot/ Power BI, too.  For example, you can create helper columns in calculated columns to get the result you want.

DataNinja777_0-1713322889890.png

DataNinja777_1-1713322939267.png

 

DataNinja777_2-1713323026574.png

DataNinja777_3-1713323047215.png

I am sure that there are more elegant ways to achive your required output in one calculated column instead of the 3 columns approach above, but your required output is achived in this manner, too.   

@DataNinja777 thank you for your help

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.