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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Conditional Usage of Columns

I've been trying to do something that looks simple but still couldn't find any answers to:

 

I have 2 columns A and B and I'm calculating a measure using both. What should I do if I wanted the user to be able to click a button (or buttons) to make it possible for the measure to be computed for different scenarios according to the button selected, e.g. using:

- only the values of column A or

- only the values of column B or

- both columns

 

Thank you in advance! 

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

You can create a slicer with the options. A one-column table:

SlicerTable

Option 1 

Option 2

Option 3

The user can then select the option in the slicer.  Your measure would read the contents of the slicer and perfomr the required calculation based on it. Something like:

Measure =
SWITCH (
    SELECTEDVALUE ( SlicerTable[Option] ),
    "Option 1", SUM(Table1[Col A]), 
    "Option 2", SUM(Table1[Col B]),
    "Option 3", SUM(Table1[Col A]) + SUM(Table1[Col B])
)

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

 

View solution in original post

1 REPLY 1
AlB
Community Champion
Community Champion

Hi @Anonymous 

You can create a slicer with the options. A one-column table:

SlicerTable

Option 1 

Option 2

Option 3

The user can then select the option in the slicer.  Your measure would read the contents of the slicer and perfomr the required calculation based on it. Something like:

Measure =
SWITCH (
    SELECTEDVALUE ( SlicerTable[Option] ),
    "Option 1", SUM(Table1[Col A]), 
    "Option 2", SUM(Table1[Col B]),
    "Option 3", SUM(Table1[Col A]) + SUM(Table1[Col B])
)

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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