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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
TuckRhodes
Helper I
Helper I

Dynamic Column Metrics

I am trying to recreate the 'Column Quality' Power Query feature in Power BI. For example, I would like to get a null or blank percentage based on a column that the user has chosen from a field parameter that contains all of the column names. Here is my current DAX:

 

Null Percentage =
VAR selected_column = SELECTEDVALUE('Column'[Column Fields])
VAR num_rows = COUNTROWS(Table1)
VAR num_null = COUNTROWS(FILTER(Table1, ISBLANK(selected_column))))
RETURN DIVIDE(num_null, num_rows)

Currently, this measure returns 100% all the time which I know is incorrect. I have tried not using the select_column variable thinking maybe it was a caching issue but that did not work.

 

Thanks for any and all help!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @TuckRhodes ,

The most common way to do this is to create measures for each column similar to the one below and then bind them to the field parameters:

Column 1 = 
VAR __num_null = CALCULATE(COUNTROWS('Table1'),ISBLANK('Table1'[Column1]))
VAR __num_rows = COUNTROWS('Table1')
RETURN DIVIDE(__num_null,__num_rows) + 0

vcgaomsft_0-1716520357204.png

The pbix file is attached for reference.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

4 REPLIES 4
Ray_Minds
Continued Contributor
Continued Contributor

Please take look in the below highlighted calculation. You need change with this query. I hope that would be helpful.
Null Percentage =
VAR selected_column = SELECTEDVALUE('Column'[Column Fields])
VAR num_rows = CALCULATE (COUNTROWS(Table1), All(Table1))
VAR num_null = COUNTROWS(FILTER(Table1, ISBLANK(selected_column))))
RETURN DIVIDE(num_null, num_rows)



Unfortunately, this is still giving me the same result.

Anonymous
Not applicable

Hi @TuckRhodes ,

The most common way to do this is to create measures for each column similar to the one below and then bind them to the field parameters:

Column 1 = 
VAR __num_null = CALCULATE(COUNTROWS('Table1'),ISBLANK('Table1'[Column1]))
VAR __num_rows = COUNTROWS('Table1')
RETURN DIVIDE(__num_null,__num_rows) + 0

vcgaomsft_0-1716520357204.png

The pbix file is attached for reference.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

I was worried about that, but I am beginning to think that is the only way. I'm going to have quite a few columns to do this for which is why I was trying to avoid making the measure for each column but maybe that is the only way.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.