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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DataScientist
Frequent Visitor

How to calculate "All" in single select slicer

I have two tables with Browser column. Table A has the following values in Browser column,

{"All", "Chrome", "IE", "Edge", "Firefox", "Safari"}

 

Table B has the following values in Browser column (the same as table A except "All")

{"Chrome", "IE", "Edge", "Firefox", "Safari"}

 

I want to use a slicer to display value based on user selection. But due to the values in other columns, table B doesn't allow multiple selection (there is no valid data when selecting both "Chrome" and "IE", for example). So I set the slicer to be single select. But table B doesn't have "All" value. So the question is, is there a way to define a logic to let table B display aggregated data of the rest values when user selects "All" (Chrome + IE + Edge + Firefox + Safari)? Basically is to simulate the logic of "select all" in a single select slicer.

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @DataScientist 

I uploaded my sample .pbix file here BrowserModel.pbix

I created a calculated table to pull together the browser list from both tables (never know when a new one will hit your data)

 

Browsers = 
DISTINCT(
    UNION(
        DISTINCT(TableA[Browser]),
        DISTINCT(TableB[Browser])
    )
)

Then I join that back into both Table A and Table B.

 

The calcs for Table A are straight forward and with the browser table the calcs for Table B are not too bad.  I have a date column in my sample so I also have a date table just for testing the behavior.

 

Table B Measure = 
VAR Browser = SELECTEDVALUE( Browsers[Browser] )
VAR DatesSelected = VALUES ( Dates )
RETURN
IF ( Browser = "All",
    CALCULATE( SUM ( TableB[Users] ), ALL ( TableB ), DatesSelected ),
    SUM ( TableB[Users] )
)

Here is a view from the linked .pbix showing the raw data and filtered visuals output

BrowsersExample.jpg

 

 

View solution in original post

5 REPLIES 5
jdbuchanan71
Super User
Super User

Hello @DataScientist 

I uploaded my sample .pbix file here BrowserModel.pbix

I created a calculated table to pull together the browser list from both tables (never know when a new one will hit your data)

 

Browsers = 
DISTINCT(
    UNION(
        DISTINCT(TableA[Browser]),
        DISTINCT(TableB[Browser])
    )
)

Then I join that back into both Table A and Table B.

 

The calcs for Table A are straight forward and with the browser table the calcs for Table B are not too bad.  I have a date column in my sample so I also have a date table just for testing the behavior.

 

Table B Measure = 
VAR Browser = SELECTEDVALUE( Browsers[Browser] )
VAR DatesSelected = VALUES ( Dates )
RETURN
IF ( Browser = "All",
    CALCULATE( SUM ( TableB[Users] ), ALL ( TableB ), DatesSelected ),
    SUM ( TableB[Users] )
)

Here is a view from the linked .pbix showing the raw data and filtered visuals output

BrowsersExample.jpg

 

 

I have a further question, @jdbuchanan71 . There are 4 pivots in my report with this problem that table A has "All" value, but table B doesn't. How can I tweak the logic for table B measure to count for 4 pivots? The total count of possible combinations of selecting "All" in 4 pivots is about 16. Is there an easy way to present it in the measure?

 

Table B Measure =
VAR Browser = SELECTEDVALUE( Browsers[Browser] )
VAR DatesSelected = VALUES ( Dates )
RETURN
IF ( Browser = "All",
    CALCULATE(SUM ( TableB[Users] ), ALL ( TableB ), DatesSelected ),
    SUM ( TableB[Users] )
)

Hello @DataScientist 

I'm not really understanding the problem you are facing.  Can you post your .pbix and highlght the problem and desired outcome?

I updated the .pbix file you uploaded with more slicers. There are 4 slicers in total. Still, only table A has the value of "All", table B doesn't. The user can select "All" from any slicers. How to calculate Table B measure in this case?

 

 More Slicers.png

Can you share your .pbix file?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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