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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply

Return result based on slicer selection

I have created one measure .

Measure = IF(SELECTEDVALUE(slicer[option])="No",0,IF(SWITCH(TRUE(),NOT(VALUES(email_notification_info[domain_url])) IN VALUES(Excluded_domains[domain]),0,1),1))
 
when user clicks on yes then it will be  exclude the domains from result set and when user click on No it will show all data.
but using above measure it is not working bcos .
NOT(VALUES(email_notification_info[domain_url])) IN VALUES(Excluded_domains[domain])
this will return multiple values. and expected single value there also countrows not working
 Data is like this that is sum of user data in the column total number of email notifications
rock_stage_user_0-1667056757134.png
Email notification data
 rock_stage_user_1-1667056958231.png

 

 

15 REPLIES 15
v-yanjiang-msft
Community Support
Community Support

Hi @rock_stage_user ,

I have received your private message, as we are only working on the forum, we can only provide help on the forum, if you need to connect over a call, you can create a support ticket in Power BI, which needs a Pro license. Certainly, you can connect here in the forum.

 

Best Regards,
Community Support Team _ kalyj

I have following report

rock_stage_user_0-1667280261807.png

It contains 604 registred user before applying any filter. after apply filter it shows count 229 which is correct, 

rock_stage_user_1-1667280348388.png

but when i am selecting no it shows other records which is satisfying the condition , but i want all records when i am selecting No as per first screenshot

rock_stage_user_2-1667280403306.png

I have created that filter using one column which is excluding the domains from result set.

rock_stage_user_3-1667280556891.png

so pls let me know how should i proceed.

 

 

 

 

Hi @rock_stage_user ,

Based on your snapshot, what you selected in the slicer isn't "Yes" or "No", but the True/False column from the table. A column can only filter the table exactly based on the value.

vkalyjmsft_0-1667288162046.png

If you want to custom the slicer, you should create a new table like this:

vkalyjmsft_1-1667288560547.png

Then create a measure.

Measure =
IF (
    ISFILTERED ( slicer[option] ),
    IF (
        SELECTEDVALUE ( slicer[option] ) = "Yes"
            && MAX ( new_processor_info[Excluding data from agencies and Mastercard Employees] ) = "TRUE",
        1,
        IF ( SELECTEDVALUE ( slicer[option] ) = "No", 1 )
    ),
    1
)

Put the measure in the fact visual filter and set to 1, then the created Yes/No slicer can filter as expected:

vkalyjmsft_2-1667289207019.png

vkalyjmsft_3-1667289305904.png

vkalyjmsft_4-1667289319600.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

rock_stage_user_0-1667290434933.png

max is not work with boolean type

Hi @rock_stage_user ,

Sorry I forgot to mention, in order to reference the True/False column, I change the data type to text.

Best Regards,
Community Support Team _ kalyj

 

rock_stage_user_0-1667291331971.png

I have created one column as a check with text type TRUE/FALSE based on the true/false column but still its not working i have added measure also in view level.

rock_stage_user_1-1667291540295.png

is there i am missing something?

 

Hi @rock_stage_user ,

You should put the visual filter on the table visual or map visual, but not the slicer.

vkalyjmsft_1-1667353900905.png

Best Regards,
Community Support Team _ kalyj

 

 

I have added but still not working,

rock_stage_user_0-1667381632096.pngrock_stage_user_1-1667381664589.png

Measure_3 =
IF(ISFILTERED(slicer[option]),IF (
SELECTEDVALUE ( slicer[option] ) = "Exclude the data from Agencies and Mastercard employees" && MAX(email_notification_info[Test_check]) = "Yes",1,
IF (
SELECTEDVALUE ( slicer[option] ) = "Show all the data including Agencies and Mastercard employees",
1
)
),1)
applied this measure on filter
rock_stage_user_2-1667381799277.png

let me know what is wrong it is not working at all in this report

v-yanjiang-msft
Community Support
Community Support

Hi @rock_stage_user ,

According to your description, I create a sample.

vkalyjmsft_0-1667200738316.png

Based on your formula, it can get the correct result.

vkalyjmsft_1-1667200813442.png

The result are different is because the conditions in the two formula are different.

vkalyjmsft_2-1667201011745.png

If you can't return correct result, please check two points:

1.If the column format of Excluding data from agencies and Mastercard Employees is True/false.

vkalyjmsft_3-1667201317590.png

2.Add "ALL" in the formula like this:

Formula1 =
VAR selection =
    SELECTEDVALUE ( slicer[option] )
RETURN
    (
        SWITCH (
            TRUE (),
            selection = "Yes",
                COUNTROWS (
                    FILTER (
                        ALL ( new_processor_info ),
                        new_processor_info[Excluding data from agencies and Mastercard Employees]
                            = FALSE ()
                    )
                ),
            selection = "No", 0
        )
    )

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

if you see below records

rock_stage_user_0-1667202469886.png

and report

rock_stage_user_1-1667202517543.png

 

if i am clicking on yes then it will show count 1 and if i am click on No then result must be all that is in case here is 2 so pls let me know how we can write meaure or something other ways to do it

 

Hi @rock_stage_user ,

According to your description, here's my solution. Create a measure:

Measure =
IF (
    SELECTEDVALUE ( slicer[option] ) = "Yes",
    COUNTROWS (
        FILTER (
            new_processor_info,
            new_processor_info[Excluding data from agencies and Mastercard Employees]
                = TRUE ()
        )
    ),
    IF (
        SELECTEDVALUE ( slicer[option] ) = "No",
        COUNTROWS ( 'new_processor_info' )
    )
)

Get the correct result:

vkalyjmsft_0-1667208377342.png

  vkalyjmsft_1-1667208389075.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thanks for your reply, but i want to show all records if i am click on No and when i am click on yes only true related records it will show in the report.

aj1973
Community Champion
Community Champion

Hi @rock_stage_user 

Your request is not really clear but in a simple glance I can tell that your measure works fine only when the silcer selection is on "No" 

aj1973_0-1667082302291.png

No Options created for "Yes"

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

can you pls let me know how should i proceed for yes option with if any aggregation over there,like sum,count

i have tried diff diff ways bit still not giving correct answer

Sorry, my mistake,

Measure = Var selection = SELECTEDVALUE(slicer[option]) RETURN (SWITCH(TRUE(),selection = "Yes",CALCULATE(COUNT(email_notification_info[user_id]),email_notification_info[Excluding data from agencies and Mastercard Employees]=TRUE),selection="No",0))
this is the one measure i have tried but given wrong result,
and another 
Measure = Var selection = SELECTEDVALUE(slicer[option])
RETURN (SWITCH(TRUE(),
selection = "Yes",countrows(FILTER(new_processor_info,new_processor_info[Excluding data from agencies and Mastercard Employees]= FALSE())),
selection="No",0))
not gives the actual sum/count

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors