Forum Discussion
Implement data masking within matrix visual using DAX expressions
- 1 year ago
Hi, all!
Thanks to all of you for providing solutions!
It turned out that there were some rows in the Azure SQL database table that contained null values for the age_group field, which messed up with the calculations. Therefore, I used bhanu_gautam's suggestion and then added the condition `NOT ISBLANK('gold fact_member_count_monthly_sylwester'[age_group])` within the FILTER function to exclude such rows from being accounted in the calculations, then it worked like a charm.
Once again, thank you for helping me out with this one!
Hi smasl94 ,
You can try modifying
VAR ShouldBeMaskedForAssociationGender with
VAR ShouldBeMaskedForAssociationGender=
FILTER(
ALL('gold fact_member_count_monthly'),
'gold fact_member_count_monthly'[association_id] = CurrentAssociation &&
'gold fact_member_count_monthly'[gender] = CurrentGender
)
VAR MaskCondition =
COUNTROWS(
FILTER(
MemberSubset,
VALUE('gold fact_member_count_monthly'[num_members]) >= 1 &&
VALUE('gold fact_member_count_monthly'[num_members]) <= 4
)
) > 0
RETURN
IF(
IsGrandTotal || IsTotalColumn,
MemberCount,
IF(
MaskCondition,
"**",
MemberCount
)
)
Additionallly,to further validate the measure, try to return rows with the given condition and check the root cause if this is actually returing the desired values with the correct gender.
Use:
RETURN
COUNTROWS(
FILTER(
VAR ShouldBeMaskedForAssociationGender,
VALUE('gold fact_member_count_monthly'[num_members]) >= 1 &&
VALUE('gold fact_member_count_monthly'[num_members]) <= 4
)
)
Hope this helps!