Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Counting NonBlank Cells across multiple columns

Hello House,

I have a dataset where I used "SplitColumn by Delimeter" to split a particular column into several columns. Now, I will like to have a calculated column that will count the number of cells with non-blank for each row.

 

Ayowumi_0-1601213822084.png

 

Thank you.

 

@amitchandak 

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

@Anonymous I would recommend unpivoting those columns in Power Query. However, if for some reason you need them in multiple columns, you could use MC Aggregations:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Multi-Column-Aggregations-MC-Aggregations/m-p/391698#M129

MC Count Blank = 
VAR tmpCol1 = SELECTCOLUMNS(Data,"Column",[Column1])
VAR tmpCol2 = SELECTCOLUMNS(Data,"Column",[Column2])
VAR tmpCol3 = SELECTCOLUMNS(Data,"Column",[Column3])
VAR tmpCol4 = SELECTCOLUMNS(Data,"Column",[Column4])
VAR tmpTable = UNION(UNION(UNION(tmpCol1,tmpCol2),tmpCol3),tmpCol4)
VAR tmpValue = COUNTROWS(FILTER(tmpTable,ISBLANK([Column]))
RETURN tmpValue


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank you very much for your quick response. This is appreciated. 

I actually do need the splitting in the multiple columns hence this request.

When I copied and edited the syntax you suggested, it gave me some error. Please see the screenshot below

 

Ayowumi_0-1601216823698.png

 

I think the error is from second to last step of the formula (ISBLANK([Column]))):

MC Count Blank =
VAR tmpCol1 = SELECTCOLUMNS(MAD,"Column",[Please mention all the food your child ate between yesterday and now, Day&Nigh.1])
VAR tmpCol2 = SELECTCOLUMNS(MAD,"Column",[Please mention all the food your child ate between yesterday and now, Day&Nigh.2])
VAR tmpCol3 = SELECTCOLUMNS(MAD,"Column",[Please mention all the food your child ate between yesterday and now, Day&Nigh.3])
VAR tmpCol4 = SELECTCOLUMNS(MAD,"Column",[Please mention all the food your child ate between yesterday and now, Day&Night.])
VAR tmpTable = UNION(UNION(UNION(tmpCol1,tmpCol2),tmpCol3),tmpCol4)
VAR tmpValue = COUNTROWS(FILTER(tmpTable,ISBLANK([Column]))
RETURN tmpValue

 

@Greg_Deckler 

@Anonymous There is just a missing ) in the line before RETURN:

MC Count Blank = 
VAR tmpCol1 = SELECTCOLUMNS(Data,"Column",[Column1])
VAR tmpCol2 = SELECTCOLUMNS(Data,"Column",[Column2])
VAR tmpCol3 = SELECTCOLUMNS(Data,"Column",[Column3])
VAR tmpCol4 = SELECTCOLUMNS(Data,"Column",[Column4])
VAR tmpTable = UNION(UNION(UNION(tmpCol1,tmpCol2),tmpCol3),tmpCol4)
VAR tmpValue = COUNTROWS(FILTER(tmpTable,ISBLANK([Column])))
RETURN tmpValue


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank you @Greg_Deckler . The syntax returned aggregate value for all rows. This is not what I want. Please see screenshot below:

 

Ayowumi_0-1601284112313.png

 

For this screenshot, you would notice that only the first column has values while the rest has are blanks. The figures here should 1. Please can you help out.

@Anonymous Maybe:

MC Count Blank = 
VAR __Table = SUMMARIZE('Table',[Column],"__Column1",MAX([Column1]),"__Column2",MAX(Column2]),"__Column3",MAX([Column3]),"__Column4",MAX([Column4]))
VAR tmpCol1 = SELECTCOLUMNS(Data,"Column",[__Column1])
VAR tmpCol2 = SELECTCOLUMNS(Data,"Column",[__Column2])
VAR tmpCol3 = SELECTCOLUMNS(Data,"Column",[__Column3])
VAR tmpCol4 = SELECTCOLUMNS(Data,"Column",[__Column4])
VAR tmpTable = UNION(UNION(UNION(tmpCol1,tmpCol2),tmpCol3),tmpCol4)
VAR tmpValue = COUNTROWS(FILTER(tmpTable,ISBLANK([Column])))
RETURN tmpValue


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Anonymous I'm on my phone so hard to see error message. But may try

COUNTROWS(FILTER(tmpTable,[Column]=BLANK()))



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.