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.
Hi Team,
I work in the healthcare industry, and it is important that we obfuscate aggregated patient results if they result in <= 10.
So my viz is using a calculated measure of
DISTINCTCOUNT('TableName'[Patient Id])
and it works great and instantaneously.
When I try to obfuscate anything 10 and under to a 5 using =
IF(DISTINCTCOUNT('TableName'[Patient Id] <= 10, 5, DISTINCTCOUNT('TableName'[Patient Id])
It doesn't seem to do the distinct count before evaluating. Before I was returning about 20 aggregated records, when adding the code above it turns into several hundred thousand and eventually times out.
Any suggestions?
Solved! Go to Solution.
Well after fighting this for a while, I noticed that I needed to control with a between statement to avoid zero values and then everything worked fine.
Solution:
# of Patients = IF(DISTINCTCOUNT('TableName'[Patient Id]) > 0 && DISTINCTCOUNT('TableName'[Patient Id]) <= 10, 5, DISTINCTCOUNT('TableName'[Patient Id]))
Maybe this can help someone else.
Well after fighting this for a while, I noticed that I needed to control with a between statement to avoid zero values and then everything worked fine.
Solution:
# of Patients = IF(DISTINCTCOUNT('TableName'[Patient Id]) > 0 && DISTINCTCOUNT('TableName'[Patient Id]) <= 10, 5, DISTINCTCOUNT('TableName'[Patient Id]))
Maybe this can help someone else.
Hi @powerdev,
Based on my test, calculating Distinctcount nested in an IF function works great. But the result returned by a measure would be affected by context.
It doesn't seem to do the distinct count before evaluating. Before I was returning about 20 aggregated records, when adding the code above it turns into several hundred thousand and eventually times out.
Could you show me the unexpected result you got now? Also, I need more detailed description about how to simulate a similar report as yours.
Regards,
Yuliana Gu
Not sure if this will help, but try precalculating the measure as a variable so that it doesn't have to evaluate twice.
Obfuscated Measure = VAR Test = DISTINCTCOUNT(TableName[Patient ID]) RETURN IF( Test <= 10, 5, // Obfuscating Test )
Also, this may have just been a typo, but you were missing a few ")" in your code.
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 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |