cancel
Showing results for
Did you mean:
Frequent Visitor

## Sum with Conditions

Hi,

I have a calculation that needs your help like this:

+ Data table contains amount of each sections :

 Sect Amount 1 90 1 65 2 75 4 60 5 30 5 70

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

 Sect Cal_Note 1 2 3 1 + 2 4 5 6 3 - 4 - 5

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

 Sect Cal_Note Desired Outcome 1 155 2 75 3 1 + 2 230 4 60 5 100 6 3 - 4 - 5 70

Thanks,

3 REPLIES 3
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!

Community Champion

Hello @cong_nguyen_acc

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

Cheers!
Vivek

https://www.vivran.in/

Frequent Visitor

Dear

Calculation in section list is fixed.

Announcements

#### The Power BI Community Show

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

#### Ted's Dev Camp - July 28, 2022

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