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
bvanevr
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
Employee
Employee

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

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.

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
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.