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

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

Reply
ifarias
New Member

AND function on PowerBI slicers

I created a slicer like this on PowerBI, but I would like the values to add up as "AND" conditions, rather than as "OR". For instance, I would like the values returned to be those where Chris Gray AND Carlos Grillo are managers, rather than Chris Gray OR Carlos Grillo are managers. How can I do this?

 

253392-screen-shot-2022-10-23-at-230228.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

still not sure but try :

 

Selected Measure Value = 
    SWITCH(SELECTEDVALUE('Measures for Slicer'[Measure])
        , "Managers", [Manager Names]
        , BLANK()
        )

Selected Measure Value (only for managers) = 
    // Get the number of managers you selected
    VAR SelectedmanagerCount = CALCULATE(COUNTROWS(VALUES(table[managers]))
                                        , ALLSELECTED(table))
    VAR output = SUMX (
        VALUES( table[manager] ),    //Get each manager in the current context
        VAR x = ADDCOLUMNS (            //For each manager, set a flag for whether 
                                        //there is data for each selected manager
                    ALLSELECTED ( table ),
                    "Flag", IF ( NOT (ISBLANK ( [Selected Measure Value] ), 1, 0 )
                    )
        //Count up the number of sales with data for each manager
        VAR salesWithDataFormanager = SUMX ( x, [Flag] )
 
        //If the number of managers for the facility matches the number of 
        //selected managers, include that value, otherwise exclude it.
        RETURN
            IF ( salesWithDataFormanager = SelectedmanagerCount, [Selected Measure Value] )
        )
    RETURN output

 

View solution in original post

4 REPLIES 4
AliakseiIvaneka
Advocate I
Advocate I

Hi, you can have multiple selection by pressing CTRL and selecting other values

Hello! Thanks for the suggestion, but doing that only returns the *value "OR" value* results, which is what I am trying to avoid.

Anonymous
Not applicable

still not sure but try :

 

Selected Measure Value = 
    SWITCH(SELECTEDVALUE('Measures for Slicer'[Measure])
        , "Managers", [Manager Names]
        , BLANK()
        )

Selected Measure Value (only for managers) = 
    // Get the number of managers you selected
    VAR SelectedmanagerCount = CALCULATE(COUNTROWS(VALUES(table[managers]))
                                        , ALLSELECTED(table))
    VAR output = SUMX (
        VALUES( table[manager] ),    //Get each manager in the current context
        VAR x = ADDCOLUMNS (            //For each manager, set a flag for whether 
                                        //there is data for each selected manager
                    ALLSELECTED ( table ),
                    "Flag", IF ( NOT (ISBLANK ( [Selected Measure Value] ), 1, 0 )
                    )
        //Count up the number of sales with data for each manager
        VAR salesWithDataFormanager = SUMX ( x, [Flag] )
 
        //If the number of managers for the facility matches the number of 
        //selected managers, include that value, otherwise exclude it.
        RETURN
            IF ( salesWithDataFormanager = SelectedmanagerCount, [Selected Measure Value] )
        )
    RETURN output

 

Anonymous
Not applicable

hello @ifarias  can you please provide some sample data

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.