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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Hiding columns if blank

Hello,

 

I am currently having issues with the following case:

 

I have a table that groups different types of information, with 40 columns, but each case has values in a different columns. Example:

Type-Col 1_Col 2_Col 3_Col 4

A --- -X-----X----" "----" " -

A --- -X-----X----" "----" "--

B --- -X-----X----" "---- X --

C --- -X ----" "---" "----" " -

D --- " " ----X----" "----X- -

D --- " " ----X----" "----X- -

E --- " " --- "  " -- X ----" " -

 

Meaning X: has data, " " does not have data (a blank). Is it possible in Power BI to construct one table with all colums and, when I filter by Type (A, B, C, D, E), it only shows the columns does contain data?

 

I have tried by leaving the column with no name, and it would do the tick, but then I don't know which value X it is showing.

 

Regards,

Antonio

7 REPLIES 7
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Unfortunately, it is not possible to hide/show column conditionally based on slicer selection. Here is a similar idea, you could click to vote it up.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
zoloturu
Memorable Member
Memorable Member

@Anonymous,

 

It is not supported in Power BI. 

 

You can also check similar thread - http://community.powerbi.com/t5/Desktop/Conditionally-display-columns-based-on-options-in-report-filters/td-p/39107

Anonymous
Not applicable

That was something I was almonst certain, but maybe there is some who knows a trick or a custom visual that allows to do this basic task.

 

Thanks,

Antonio

@Anonymous,

 

You can play with R scripting in a way to remove columns (which called variables in R) if first value in column is NULL.

 

Run R scriptRun R script

Anonymous
Not applicable

Hello,

 

This wouldn't work as the columns would be deleted in the query phase, right?

 

What I need is a 20-values column that, depending on the data, auto-filters to only either 10, 12 or 15 of those columns, without having blank columns, as it gives unnecesary information and creastes a horizontal scroll I definitely not want.

 

This feature is a must, but I don't see neither many votes in the Ideas about this issue nor any announcement to include it in following PBI releases.

 

Regards

@Anonymous,

 

Actually if you will load R script which will take only not empty columns from your data source and in Power BI M script you will not do any column specific transformation then it will work properly. Let me know if this is not clear.

Anonymous
Not applicable

Hello,

 

I don't know about R, could you share some code so I can start bulding the tabla in R?

 

Thanks,

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors