mobcdi
mobcdi

Reputation: 1592

In PowerBI what options are there to hide/redact/mask values in visuals to anonymise data

What options are there in PowerBI to suppress, redact or hide values to anonymise values in reports and visuals without loosing detail and have that restriction apply to multiple pages in a report?

Cat Count %
Category 1 23 10
Category 2 2 0.9%
Category 3 4 1.7%

So that its possible to keep the rows but end up with a placeholder where count is <4 and % is greater than 1% but less than 2%

Cat Count %
Category 1 23 10
Category 2 * 0.9%
Category 3 4 *

So far my experience has been

  1. a measure with a filter applied will hide rows but you can't apply a measure filter to an entire page or all report pages.
  2. Ive seen mention of conditional formatting to hide the value by having the font and background the same colour but that seems open to error and labour intensive.

I also want to be clear when a value has been suppressed or masked

I suspect there is a more better way but I haven't been able to figure out where to even start.

Upvotes: 2

Views: 2457

Answers (2)

Matt Kocak
Matt Kocak

Reputation: 808

It depends on your data connection type as to whether this is available, but a calculated column (instead of a measure) can be used as a filter at the "this page" or "all pages" level.

If this option is available, then you can find it right next to the "New Measure" field.

Calculated Column

Using this and your sample data above, I created a couple of calculated columns and show the resulting table. You can then display these columns and use them as filters throughout the report. Your DAX may be slightly different depending on how the actual data is formatted and such.

Count Calculated Column

Masked Count = 
    IF(
        'Table'[Count] < 4, 
        "*", 
        CONVERT('Table'[Count], STRING)
    )

% Calculated Column

Masked % = 
    IF(
        'Table'[%] > .01 && 'Table'[%] < .02, 
        "*", 
        CONVERT('Table'[%] * 100, STRING) & "%"
    )

Resulting Table

Result Table

Example of how the filter can be used

Filter Example

The values of these columns will update as your data source is refreshed in Power BI. However, calculated columns aren't available for Live Connection, in which case you would have to do this kind of logic at a lower level (in Analysis Services for example).

Additionally, you could potentially use Power Query Editor to accomplish this kind of thing.

Upvotes: 1

davidebacci
davidebacci

Reputation: 30289

OK, I have something working but you will need Tabular Editor to create a calculation group. Here are the steps.

  1. I'm using the following table (named "Table") as the source data.

enter image description here

  1. Add two measures (calculation groups only work on measures) as follows.

    % Measure = SUM('Table'[%])

    Count Measure = SUM('Table'[Count ])

  2. Open tabular editor and create a new calculation group named "CG" with a calculation item named "Mask". Paste the following code into the calculation item.

    if ( (selectedmeasurename() = "% Measure" && selectedmeasure() >1 && selectedmeasure() <2) || (selectedmeasurename() = "Count Measure" && selectedmeasure() <4) ,"*",selectedmeasure() )

enter image description here 4. Save the calculation group and in Power BI drag the name column onto the filter for all pages as follows, ensuring it is selected:

enter image description here

  1. The masking will now happen across all reports automatically. Below you can see the same table on two different reports which have now been successfully masked.

enter image description here

enter image description here

Upvotes: 1

Related Questions