I have some data with suppression in it. Sometimes this is for a 'low' value, sometimes to protect anonymity (with a 'c').
Location | Value |
---|---|
London | 1534 |
Cardiff | 238 |
Wellington | c |
Prague | low |
At the moment I think my options are:
If I just keep the data as it is, Power BI rightly makes the data type a string (ABC123) icon. But with this, I can't create meaningful visualisations, as I just get the option to 'count' each field rather than take the value as a numeric.
The best option would be to create a new column that you can use with numbers in it, so you can keep your original data, but have a column to work from In Power Query it would be a custom column:
if Value.Is(Value.FromText([Value]), type number) then Value.FromText([Value]) else 0
This will check using Value.FromText is a number. Value.Is will return true/false. So it is a number it will convert the text to a number, if not, in this case I've set it to 0, you can set it to NULL or whatever you logic requires.
In DAX you would create a calculated column
NewValue = IF(ISERROR ( VALUE ( 'Table'[Column1]) ), 0, VALUE ( 'Table'[Column1]) )
This will check if the text can be converted to a value, if not it will be 0, otherwise it will turn it to a number
Best to do it in Power Query, so it ready for the model to use.