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
sleepingdog
Microsoft Employee
Microsoft Employee

SUM multiple columns based on user selection

Your help please and I am open to any ideas and solutions on how to accomplish this.

 

I have a data table with 4 columns; columns A,B & C are whole numbers and Type is text (see example below).

The client wants the ability to select any combination of columns A, B and/or C with the expected result being the sum of the selected columns.

 

EXAMPLE

Data Table  
ABCType
521Bird
362Cat

 

measures: a=
a = calculate(  sum( A ) )
b = calculate( sum( B ) )
c = calculate( sum( C ) )

 

Slicer #1Slicer #2
ABird
BCat
C 

 

Scenario #1:Scenario #2:Scenario #3:
Selected Slicer #1:  A, B, CSelected Slicer #1:  A, CSelected Slicer #1:  A
Selected Slicer #2: BirdSelected Slicer #2: BirdSelected Slicer #2: Cat
Expexted Total : 5+2+1 = 8 Expexted Total : 5+1 = 6Expexted Total : 3

 

Results Table  
scenariototalType
#18Bird
#26Bird
#33Cat

 

Thank you advance for your input, ideas and help

1 REPLY 1
ryan_mayu
Super User
Super User

@sleepingdog 

you can select the type column and unpivot other columns in PQ

11.PNG12.png

13.png

 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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