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
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
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.