Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
EricMamet
Helper I
Helper I

How to dynamically mask data?

In our database, we have a "Secret" boolean flag on each fact row.

 

Whenever I try to report on our data, I cannot return a member as a separate named entity if all the underneath leaf rows are marked with "Secret". In that case, I must group the member value with a real or pretend member "Others".

 

In the screenshot below I show the expected results depending on the queries

 

Base Data and Expectations.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I understand in each request, I would have to invent an "Others" member if it does not exist and assign it the value that are "secret" in this context.

 

Any hint how I could go about doing this?

 

 Thanks

 

PS: Just in case you want to "practice"...

CREATE TABLE dbo.Fact( Colour VARCHAR(100) NOT NULL
, Shape VARCHAR(100) NOT NULL
, Size VARCHAR(100) NOT NULL
, Secret BIT NOT NULL
, Qty INTEGER NOT NULL
, PRIMARY KEY(Colour, Shape, Size)
);
GO

INSERT INTO dbo.Fact(Colour, Shape, Size, Secret, Qty)
VALUES ('Blue', 'Square', 'Big', 0, 1)
,('Green', 'Round', 'Big', 0, 3)
,('Green', 'Square', 'Small', 1, 2)
,('Blue', 'Triangle', 'Big', 0, 5)
,('Red', 'Round', 'Small', 1, 2)
,('Red', 'Square', 'Small', 1, 7)
,('Red', 'Square', 'Big', 0, 4)

 

2 REPLIES 2
amitchandak
Super User
Super User

@EricMamet , refer if these can help

https://www.biinsight.com/power-bi-desktop-query-parameters-part2-dynamic-data-masking-and-query-par...

https://radacad.com/secure-the-sensitive-data-in-power-bi-data-masking-better-with-row-level-securit...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Not directly but the second article (radacar...) has an idea that might be useful: splitting the original table into two.

I could split the "Secret" rows from the non secret ones... although I don't have any idea what to do next !!! 😂

 

My difficulty is that we need to hide column members dynamically depending on the presence or not of "non secret" data underneath and reporting everything hidden under an "Others" member that may or may not exist as well.

 

Finding out whether the numbers should be displayed normally is the easy bit I suspect...

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.