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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MarDen94
Helper I
Helper I

Summarize multiple columns in one slicer

Hi, 

 

I've got a question regarding some DAX-logic to create a slicer. 

I am working with a table similar to this one: 

 

ID

Option1

Option2

Option3

1

TRUE

TRUE

FALSE

2

FALSE

TRUE

FALSE

3

TRUE

FALSE

TRUE

4

FALSE

FALSE

TRUE

5

TRUE

TRUE

TRUE

 

I am trying to figure out a way to create a slicer that enables me to check on of the options and show data for all lines that have these options. However I want to avoid creating 3 slicers, so the slicer should contain all 3 options as selectable. 

 

Is there a way to do this for me using DAX? 

 

NB. it would be possible to replace the boolean-fields with text where TRUE is replaced by Option# and FALSE is null. 

 

Thanks in advance

1 ACCEPTED SOLUTION

 

CountIds =
VAR SelectedOptions =
    CONCATENATEX(VALUES('Calculation group'[Calculation group column]), 'Calculation group'[Calculation group column], ", ")
VAR A = SUMMARIZE('Fact', 'Fact'[ID], "values",
    IF(
        (CONTAINSSTRING(SelectedOptions, "Option 1") && VALUES('Fact'[Option1]) = TRUE()) ||
        (CONTAINSSTRING(SelectedOptions, "Option 2") && VALUES('Fact'[Option2]) = TRUE()) ||
        (CONTAINSSTRING(SelectedOptions, "Option 3") && VALUES('Fact'[Option3]) = TRUE()),
        1,
        0
    )
)
VAR DistinctIDs = SUMMARIZE(FILTER(A, [values] = 1), [ID])
RETURN COUNTROWS(DistinctIDs)

 

_elvinbaghele_0-1698073294621.png

 

 

View solution in original post

8 REPLIES 8
_elbpower
Resolver III
Resolver III

It should be part of slicer settings. 

_elbpower
Resolver III
Resolver III

You can achieve this using Calculation Groups in Power BI. Calculation Groups allow you to create dynamic slicers that can be used to switch between different calculations or filters in your report. In your case, you want to create a slicer that allows you to select one or more options (Option1, Option2, Option3) and filter the data accordingly.

Here's how you can set up a Calculation Group to achieve this:

  1. Create a new Calculation Group: In Power BI Desktop, go to the Modeling tab and click on "New Calculation Group."

  2. Define Calculation Items: In the Calculation Group editor, define calculation items for each option (Option1, Option2, Option3). Name these calculation items accordingly.

    • For Option1:

      • Calculation Formula: FILTER('YourTable', 'YourTable'[Option1] = TRUE())
    • For Option2:

      • Calculation Formula: FILTER('YourTable', 'YourTable'[Option2] = TRUE())
    • For Option3:

      • Calculation Formula: FILTER('YourTable', 'YourTable'[Option3] = TRUE())

    These formulas use the FILTER function to filter the table based on the selected option.

  3. Add a Slicer to Your Report: Drag and drop the Calculation Group you created onto your report canvas. It will automatically create a slicer that allows you to select one or more options.

  4. Customize the Slicer: You can customize the slicer to allow multiple selections by going to the Slicer settings and enabling the "Multi-select with OR logic" option. This will allow you to select multiple options, and the report will show data for any option that is selected.

Now, when you use the slicer, you can select one or more options (Option1, Option2, Option3), and the report will dynamically filter the data based on your selections. This avoids the need for multiple slicers and provides a more user-friendly experience.
Let me know if you have any questions

Unfortunately I am still struggeling to make it completely work. 

 

I've gotten to a point where I was able to create the calculation group and it works (to an extent). 

But when I select multiple options the cout of IDs always shows the total number of possible IDs instead of a total filtered with OR-logic (current selection should return 7).

 

Hoefully the following screenshots help in explaining the issue: 

 

Dataset, Filter & MeasureDataset, Filter & Measure

 

CalcGroupCalcGroup

 

Slicer optionsSlicer options

Please share your sample PBI file

Here you go: CalcGroupIssue.pbix

 

CountIds =
VAR SelectedOptions =
    CONCATENATEX(VALUES('Calculation group'[Calculation group column]), 'Calculation group'[Calculation group column], ", ")
VAR A = SUMMARIZE('Fact', 'Fact'[ID], "values",
    IF(
        (CONTAINSSTRING(SelectedOptions, "Option 1") && VALUES('Fact'[Option1]) = TRUE()) ||
        (CONTAINSSTRING(SelectedOptions, "Option 2") && VALUES('Fact'[Option2]) = TRUE()) ||
        (CONTAINSSTRING(SelectedOptions, "Option 3") && VALUES('Fact'[Option3]) = TRUE()),
        1,
        0
    )
)
VAR DistinctIDs = SUMMARIZE(FILTER(A, [values] = 1), [ID])
RETURN COUNTROWS(DistinctIDs)

 

_elvinbaghele_0-1698073294621.png

 

 

Thanks, this was the solution I was looking for

Hi,

 

I saw that the calculation groups in the most recent version of PBI Desktop are included. 

I downloaded this version and started with the steps you provided. 

 

However in step 4 I cannot find the "Multi-select with OR logic" option you mention. Could you point me in the right direction for this? 

 

Thanks again!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.