cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
v-ljerr-msft Super Contributor
Super Contributor

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
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 447 members 4,150 guests
Please welcome our newest community members: