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.
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?
Solved! Go to Solution.
Hi @Dave82 ,
I created some data:
Here are the steps you can follow:
1. Use Enter data to create a table.
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.
4. Result:
When the slicer is Yes, display all data:
When the slicer is No, the data displayed as 0:
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
Hi @Dave82 ,
I created some data:
Here are the steps you can follow:
1. Use Enter data to create a table.
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.
4. Result:
When the slicer is Yes, display all data:
When the slicer is No, the data displayed as 0:
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
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
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |