Is there a function in Power BI that can check whether a list of specified values (numbers) exists in a column?
For example, in the image below, I have a column with some values and another one with 0 and 1s. You can see that some values are marked with 1 and some with 0. In order to do this, I used IF function, but this is just too cumbersome.
I am looking for a formula that can check if the values from a list like {XXXX, XXXX, XXXX, etc} exist in a column and that can easily be edited when I need to add other values.
Thank you and have a good day! Best, Denis
You can do that by adding a custom column for example. If we assume your table is named Table
and first column is named Value
, then add a custom column like this:
Where the list contains all the values of interest. This will give you a boolean column Flag
:
If you want an integer column with 0
and 1
values, then change the column to something like this:
= if (List.Contains({"5006", "4905"}, [Value])) then 1 else 0