Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello everyone, thank you for your attention,
I've been facing a big pain point on my report recently,
I'm trying to achieve something i would name like "Dynamic masking"
I'm on a matrix visual and wants to hide information via two criterias :
-If the number is <5, display NA
-If there is only one row with <5 in the entire column. Assign the value NA to the second littlest value
The objective is to not be able to find the number behind the value <5 by substracting the other values to the total.
The scenario :
Having a matrix visual like this
| Year 1 | |
| Versicolor | 10 |
| Virginical | 7 |
| Viridis | 4 |
| Total | 21 |
I want the matrix visual to look like this
| Year 1 | |
| Versicolor | 10 |
| Virginical | NA |
| Viridis | NA |
| Total | 21 |
I tried using this code but didn't achieve what i wanted to do
Nombre de présents anonymisé =
VAR Total1 = SUM(eTauxReussite[txRssPresents])
VAR Total2 = SUM(eTauxReussite[txRssAdmis])
VAR Count_LessThan5 =
COUNTROWS(
FILTER(
ALLSELECTED(eTauxReussite),
Total1< 5
)
)
VAR IsSingleLessThan5 = Count_LessThan5 = 1
VAR RowRank =
RANKX(
ALLSELECTED(eTauxReussite),
Total1, , ASC
)
VAR ExtraMaskedRow = RowRank = 2
RETURN
IF(
Total1 < 5 &&Total1<>0 || (IsSingleLessThan5 && ExtraMaskedRow)|| Total2<5 && Total2<>0,
"NA",
Total1
)
Thank you in advance
Solved! Go to Solution.
Hello, @NathanD
try this (it's prolly overengineered, but have a shot):
measure =
var _total = SUMX(ALL('Table'[value]), 'Table'[value])
var _value = SUM('Table'[value])
var lessThan5 = COUNTROWS(FILTER('Table', 'Table'[value] < 5))
var lowest = MINX(FILTER(ALL('Table'), 'Table'[value] < 5), 'Table'[value])
var secondLowest = MINX(FILTER(ALL('Table'), 'Table'[value] > lowest), 'Table'[value])
var _twoMore = IF(_value = lowest, "NA", _value)
var _single = IF( _value = lowest || _value = secondLowest, "NA", _value)
var _check =
SWITCH(
TRUE(),
lessThan5 = 1 || ISBLANK(lessThan5) , _single,
lessThan5 >= 2 || ISBLANK(lessThan5), _twoMore,
NOT(HASONEVALUE('Table'[name])), _total,
_value
)
return _check
Hello, @NathanD
try this (it's prolly overengineered, but have a shot):
measure =
var _total = SUMX(ALL('Table'[value]), 'Table'[value])
var _value = SUM('Table'[value])
var lessThan5 = COUNTROWS(FILTER('Table', 'Table'[value] < 5))
var lowest = MINX(FILTER(ALL('Table'), 'Table'[value] < 5), 'Table'[value])
var secondLowest = MINX(FILTER(ALL('Table'), 'Table'[value] > lowest), 'Table'[value])
var _twoMore = IF(_value = lowest, "NA", _value)
var _single = IF( _value = lowest || _value = secondLowest, "NA", _value)
var _check =
SWITCH(
TRUE(),
lessThan5 = 1 || ISBLANK(lessThan5) , _single,
lessThan5 >= 2 || ISBLANK(lessThan5), _twoMore,
NOT(HASONEVALUE('Table'[name])), _total,
_value
)
return _check
Thanks for your answer, i've asked the question poorly and your solution seems right in the environment i provided.
I'll do make another post to ask the question more deeply
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 38 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 68 | |
| 65 | |
| 30 | |
| 26 | |
| 25 |