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
Dave82
Frequent Visitor

Yes/No dropdown not working

I have a REEL_QUALITY table with an isOutlier column of values 0 or 1

Customer wants a dropdown to 'Show Outliers' with options Yes/No for a line chart. Where yes shows all rows in the table, and no only shows rows where isOutlier=0. So I created an Outliers meta table with the 2 yes/no column values and created the drop down slicer off it.

I kind of took note from a previous post here: https://community.powerbi.com/t5/Desktop/Filter-on-True-and-False-Slicer/td-p/1298949

I then created a 'ShowOutliers' measure on the REEL_QUALITY table with the following:

ShowOutliers = SWITCH(SELECTEDVALUE(Outliers[isOutlier]),

"Yes", 1,

"No", IF(SELECTEDVALUE(REEL_QUALITY[isOutlier]) = 0, 1, 0)

)

I then added this measure to the line chart filter where ShowOutliers = 1 but I am still seeing outlier data points in the line chart (values in the billions that I know are flagged as outliers).  I'm not totally sure how you tell PBI to keep or drop a row in DAX measures.  What am I doing wrong?

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Dave82 ,

I created some data:

vyangliumsft_0-1648601353358.png

Here are the steps you can follow:

1. Use Enter data to create a table.

vyangliumsft_1-1648601353360.png

2. Create measure.

Flag =
var _select=SELECTEDVALUE('SliceTable'[Slice])
var _1=CALCULATE(SUM('REEL_QUALITY'[isOutlier]),FILTER(ALL(REEL_QUALITY),'REEL_QUALITY'[Date]=MAX('REEL_QUALITY'[Date])))
return
IF(
   _select="No"&&MAX('REEL_QUALITY'[isOutlier])=1,0,1)

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1648601353361.png

4. Result:

When the slicer is Yes, display all data:

vyangliumsft_3-1648601353362.png

When the slicer is No, the data displayed as 0:

vyangliumsft_4-1648601353363.png

 

Best Regards,

Liu Yang

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

View solution in original post

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @Dave82 ,

I created some data:

vyangliumsft_0-1648601353358.png

Here are the steps you can follow:

1. Use Enter data to create a table.

vyangliumsft_1-1648601353360.png

2. Create measure.

Flag =
var _select=SELECTEDVALUE('SliceTable'[Slice])
var _1=CALCULATE(SUM('REEL_QUALITY'[isOutlier]),FILTER(ALL(REEL_QUALITY),'REEL_QUALITY'[Date]=MAX('REEL_QUALITY'[Date])))
return
IF(
   _select="No"&&MAX('REEL_QUALITY'[isOutlier])=1,0,1)

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1648601353361.png

4. Result:

When the slicer is Yes, display all data:

vyangliumsft_3-1648601353362.png

When the slicer is No, the data displayed as 0:

vyangliumsft_4-1648601353363.png

 

Best Regards,

Liu Yang

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

goncalogeraldes
Super User
Super User

Hello there @Dave82 ! I think that you are telling PBI to always consider the data as "1" because of your if statement in the SWITCH(). Dont you want something in the lines of:

ShowOutliers =
SWITCH ( SELECTEDVALUE ( Outliers[isOutlier] ), "Yes", 1, 0 )

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

@goncalogeraldes 

 

The problem is if 'No' is selected from the drop down, I still want to show the rows where isOutlier=0.  If the user selects 'Yes' from the drop down then I want to show rows where isOutlier=0 or 1.  The reason I added the if for the No section was to have the measure check to see if the current row is a 0 that needs to be displayed.  When I use your version, it blanks out all values when No is selected.

In that case, is your REEL_QUALITY[isOutlier] field comprised of 0 and 1 or "Yes" and "No". Because in your formula you mix both. If you can, please share some sample data without any sensitive data. 

 

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.