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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Sum of filtered values

Hi everyone, 

 

In Power BI, I have a dataset that contains columns with ID and linked number.

It looks like this: 

[ID_01] [Number_01]  [ID_02] [Number_02]  [ID_03]  [Number_03]
    A        12         A         03         C          45
    A        43         B         12         B          64
    B        02         B         78         C          19 
    C        14         A         51         B          23

 

What I need is, for each line, to get the sum for each ID, which would look like this: 

[ID_01] [Number_01]  [ID_02] [Number_02]  [ID_03]  [Number_03] [SUM_A] [SUM_B] [SUM_C]
    A        12         A         03         C          45       15      00      45
    A        43         B         12         B          64       43      76      00
    B        02         B         78         C          19       00      80      19
    C        14         A         51         B          23       51      23      14

 

Do you have any idea of how I could achieve it ? 

Thank you so much !

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , not very clear, refer if this can help

https://www.youtube.com/watch?v=WSnB5y2JXv8

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
DataZoe
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

 

You could do this with a calculated column in the table:

 

Sum A = if([ID_01] = "A",[Number_01],0)+if([ID_02] = "A",[Number_02],0)+if([ID_03] = "A",[Number_03],0)

 

and same for the other 2 columns.

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Anonymous
Not applicable

Thank you very much, actually the syntax that worked on my side is : 

Sum A = (if [ID_01] = "A" then [Number_01] else 0)+(if [ID_02] = "A" then [Number_02] else 0)+(if [ID_03] = "A" then [Number_03] else 0)

 

With the if inside the brackets.

Hi @Anonymous ,

If your problem has been resolved, could you please mark the helpful post as Answered? It will help others in the community find the solution easily when they face the same problem with you.

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors