cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cong_nguyen_acc
Frequent Visitor

Sum with Conditions

Hi,

 

I have a calculation that needs your help like this:

+ Data table contains amount of each sections :

SectAmount
190
165
275
460
530
570

 

+ Section List , the calculation for each section varies, for ex. ; Sect 3 = 1 + 2, Sect 6 = 3 - 4 - 5, these section will not be on data table.

SectCal_Note
1 
2 
31 + 2
4 
5 
63 - 4 - 5

 

My goal is to sum each section with the outcome like this

SectCal_NoteDesired Outcome
1 155
2 75
31 + 2230
4 60
5 100
63 - 4 - 570

 

Please help me on this ? 

 

Thanks,

3 REPLIES 3
vanessafvg
Super User
Super User

can i ask what you are trying to do with the data, does it need to be structured in this way? 

 

or would this work?     are you wanting to end up with just the final number?

outcomes =
var three = CALCULATE(sum('Table'[Amount]), 'Table'[Sect] in {1,2})
return three - CALCULATE(sum('Table'[Amount]), 'Table'[Sect] = 4) - CALCULATE(sum('Table'[Amount]), 'Table'[Sect] = 5)




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




vivran22
Community Champion
Community Champion

Hello @cong_nguyen_acc 

 

How you are defining the sections? Are they standard/fixed or dynamic?

 

Cheers!
Vivek

https://www.vivran.in/
Connect on LinkedIn

Dear vivran22,

Calculation in section list is fixed.

 

 

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors