cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
bvanevr Frequent Visitor
Frequent Visitor

DAX Need to create one Slicer that filters multiple column head if the column value is not blank

I have a table with 4 columns as regions and would like a slicer to be able to filter a region(s) - Mock up below.  The column filter needs apply only if the column has values.

 

Capture.PNG

 

So, if a user selects ("Asia" and "EMEA") then the table view would display Part A, B & C only since the "Asia" and "EMEA" values for Part D and E are null/empty.

 

Tried to use Value on a slicer from a Region table but it only allows for 1 selection and I need multiple

3 REPLIES 3
Microsoft v-ljerr-msft
Microsoft

Re: DAX Need to create one Slicer that filters multiple column head if the column value is not blank

Hi @bvanevr,

 

If I understand you correctly, you should be able to follow steps below to get your expected result.

 

1. Unpivot the 4 columns in Query Editor. You'll get a new table like below. (For more details about how to Pivot and Unpivot with Power BI, you can refer to this article)

 

T1.PNG

 

2. Then you should be able to show Part column as Rows, Attribute column as Columns, Value column as Values on Matrix visual. And use Attribute column as Slicer to get the expected result.

 

r2.PNG

 

Here is sample pbix file for your reference. Smiley Happy

 

Regards

bvanevr Frequent Visitor
Frequent Visitor

Re: DAX Need to create one Slicer that filters multiple column head if the column value is not blank

Thanks for the quick response.

 

While this works for the above problem, it causes another issue in that I am using this data set for other validations that check to see if there is a value in at least one of the regions.  The unpivot only creates rows for non null cells thus if a part does not have a region no record is maintained in the unpivot, so i am unable to test this second rule.

 

Preferred solution would keep the data structure as is and still provide the user the ability to filter by the regions.

gooranga1 Senior Member
Senior Member

Re: DAX Need to create one Slicer that filters multiple column head if the column value is not blank

Can you in Edit Queries and replace the nulls and blanks with 0 instead? This would create all the rows you need in the unpivot.

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)