Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Helo developers,
I would like create new column 'Result' for have the same output like my exemple.
Count the numbers of columns are not null.
Exemple :
| Column 1 | Column 2 | Column 3 | RESULT |
| 2 | null | null | 1 |
| null | 6 | 7 | 2 |
| null | null | null | 0 |
| 4 | 7 | 10 | 3 |
Thanks for your returns !
Solved! Go to Solution.
Hey @Mat40220 ,
You can use the List.NonNullCount how the @AnkitKukreja said.
The code is
#"Added Custom" = Table.AddColumn(YOUR_PREVIEW_STEP, "RESULT", each List.NonNullCount({[Column1],[Column2],[Column3]}))
Best Regards,
Marcel
Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI
Is there any reason why this would return an answer of 1 when all columns counted are null ?
example: (foreman.1.2 is column 8 when referencing the formula below):
results:
formula:
"Count_Foreman", each List.NonNullCount(List.Range(Record.FieldValues(_),8,4)))
This returns the correct number for all "NonNull" counts, but when all four columns are null, it returns "1" every time.
Hi @Mat40220
You can add a custom column in the Power Query editor and use the below formula.
List.NonNullCount({[Column 1],[Column 2],[Column 3]})
Hey @Mat40220 ,
Without think too much, I believe you can solve using this measure:
Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI
Thank Marcel,
But i want write the solution in power query (with M language)
Do you have an idea ?
Hey @Mat40220 ,
You can use the List.NonNullCount how the @AnkitKukreja said.
The code is
#"Added Custom" = Table.AddColumn(YOUR_PREVIEW_STEP, "RESULT", each List.NonNullCount({[Column1],[Column2],[Column3]}))
Best Regards,
Marcel
Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 54 | |
| 47 | |
| 38 | |
| 16 | |
| 15 |
| User | Count |
|---|---|
| 81 | |
| 71 | |
| 38 | |
| 28 | |
| 25 |