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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.