Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello all!
I am having issues creating a single measure that will suppress all numbers < 10 and if there is only 1 number that is < 10, then I need to suppress the next smallest number regardless of the value. The table below shows all the values. But in the corresponding bar chart, Native Hawaiian has correctly been changed to 0 for suppression....but the next smallest number (15) for Native Alaskan is still showing as 15...where it should also be 0 due to secondary suppression requirements. After lengthy conversations with ChatGPT we've arrived at the DAX measure below...but as you can see in the bar chart...it simply does not find the next lowest number and assign it a value of 0. Can anybody identify where the issue might be in the DAX logic to do this? OR better yet, is there a simpler, more elegant way to suppress all numbers < 10, and if there is only one in a group that is < 10, then find the next smallest number and suppress it as welll? Thanks for any help!
Hi @betsysimpkins ,
Depending on the information you have provided, l created a sample data to help you with your problem, you can follow these steps below:
Sample data:
1.Create new measure.
Result =
VAR _Number =
SELECTEDVALUE ( 'Table'[NUMBER] )
VAR _Numberlessthan10 =
CALCULATE (
DISTINCTCOUNT ( 'Table'[NUMBER] ),
FILTER ( 'Table', 'Table'[NUMBER] < 10 )
)
VAR _Rank =
RANKX ( ALL ( 'Table' ), CALCULATE ( MAX ( 'Table'[NUMBER] ) ),, ASC )
RETURN
IF ( _Numberlessthan10 = 1 || _Rank <= 2, 0, _Number )
Final output:
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks again for all your help...I've added a link here to some sample data from my Enrollment table. My measure to calculate the headcount of studentID is more complicated than needed for this sample data because of other filters I have to account for not shown in this dataset. But essentially it's just a distinct count of the studentID. Sample Data Extract for PBI
Thank you Ada! However, my problem is that in your example you have a table with a column for the number. My numbers are generated from a measure that does a headcount of studentID from the larger Enrollment table. So I think for your solution to work for me, I need to somehow create a table of the calculated values first right? I can't make SELECTEDVALUE work with a measure.
User | Count |
---|---|
85 | |
80 | |
77 | |
49 | |
41 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |