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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
DoesNotCompute
Regular Visitor

Filter by Multiple Column Value Conditions

Hi There,

 

I've been struggling with this for hours and can not figure a solution. Any help greatly appreciated.

 

I have a data set like the below. What I need to do via DAX (I'm trying to work in PowerPivot) is to exclude any City/State that is not in both retailers. Or to say, both retailers must be in the City/State for that City/State to remain in the data set.

 

Tried regular value filters in the pivot table (less than 0) and that did not work, so thinking I need to filter via the data model in Power Pivot.

 

So for the example below, I would exclude both Springfield, ID (only Retailer A is located here) and Phoenix, AZ (only Retailer B is located here).

 

Data Set:

RetailerCity, StateMonthSales
Retailer ALos Angeles, CA1/1/2024100
Retailer ALas Vegas, NV1/1/2024200
Retailer ASpringfield, IL1/1/2024100
Retailer ASpringfield, ID1/1/2024100
Retailer BLos Angeles, CA1/1/2024200
Retailer BLas Vegas, NV1/1/2024100
Retailer BSpringfield, IL1/1/2024200
Retailer BPhoenix, AZ1/1/2024100

 

Desired Output: 

 

DoesNotCompute_0-1712962490877.png

 

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @DoesNotCompute 

 

I produced your required output as follows:

DataNinja777_0-1712985659300.png

An example of the dax formulae to achive this output is as follows:  

 

DataNinja777_4-1712986463013.png

 

DataNinja777_1-1712985750708.png

 

DataNinja777_3-1712986420516.png

 

Where the data model looks like below:

DataNinja777_2-1712985829116.png

Best regards,

 

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

You can consider using PRODUCTX and throwing away the BLANK()  results.

I'm not familiar with PRODUCTX and the below solution from @DataNinja777 worked great. However, I will spend some time exploring this avenue as well to improve my skills. Thank you for the suggestion.

DataNinja777
Super User
Super User

Hi @DoesNotCompute 

 

I produced your required output as follows:

DataNinja777_0-1712985659300.png

An example of the dax formulae to achive this output is as follows:  

 

DataNinja777_4-1712986463013.png

 

DataNinja777_1-1712985750708.png

 

DataNinja777_3-1712986420516.png

 

Where the data model looks like below:

DataNinja777_2-1712985829116.png

Best regards,

 

Fantastic, thank you so much.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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