Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I need to find records where a group of columns all contain "null" values. If the specified columns only contain null values, then evaluate as false. If columns contain any value (ie <> blank), evaluate as true.
A | B | C | D | result |
sunny | null | rainy | null | true |
null | null | null | null | false |
Surely there must be a better way to determine this without merging cell values?
I would like to do something like:
= Table.AddColumn(#PreviousStep, "result", each if column in list <> null then true else false)
Where "list" is another referenced query with a list of the column names I want to apply the function to.
Solved! Go to Solution.
Use below in your custom column where Query1 holds the list of columns
List.RemoveNulls(Record.ToList(Record.SelectFields(_, Query1))) <> {}
Hi brendo,
You can paste below formula into the custom column formula box:
if List.NonNullCount (Record.FieldValues ( Record.SelectFields ( _, YourList ) ) ) = 0 then false else true
What this statement does is this:
Just make sure to change the 'yourlist' value to the list of columnnames you had in mind.
Do you need any additional help?
Rick
--------------------------------------------------
@ me in replies or I'll lose your thread
Master Power Query M? -> https://powerquery.how
Read in-depth articles? -> BI Gorilla
Youtube Channel: BI Gorilla
If this post helps, then please consider accepting it as the solution to help other members find it more quickly.
Use below in your custom column where Query1 holds the list of columns
List.RemoveNulls(Record.ToList(Record.SelectFields(_, Query1))) <> {}
I attempted this, but I am getting the incorrect number of blank rows (did a function in R to check for blank rows and R is showing me double the number of rows than in power query, and I am analyzing the same dataset in R). Could you explain step by step what your query does?
Query1 should be a list.
What it would do is to perform row wise operation.
For a row, it will select only those fields which are present in Query1.
It will convert this record into list. Hence, the list will contain only those values whose columns were present in Query1.
It will remove all nulls from this list and it will be compared to check whether the list is blank or not.
If list is blank it means all values were nulls. Hence, it will give false.
If there is even a single value, it will give true.
Not sure I understand your goal. You have a Reference list of data, say it contains rows with values "A" and "B" (rows not columns) Is that right?
And you want to manipulate the rows in this table, say, remove "A" and add "C", and have the results of the main query change to only look at columns B and C in the Power Query?
Proud to be a Super User! | |
I have a list of 25 column names.
I have a dataset that has 100 columns. I want to check, for every row, whether there is data in any of those 25 columns. If there is a value in one of those 25 columns, return TRUE in new column. If that record only contains null values in those 25 columns, return FALSE.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |