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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
datagnan
Frequent Visitor

Display unfiltered values from a column when a filter is applied on another column

Hey there. I'm in need of a little help, much appreciated.

I have attached a pbix file with a sample dataset of my problem.

Basically I have two categorical columns in my dataset (Name and City) and I use the unique values in them as filters. So far so good. What I want to do is when I filter by one of the columns, to be able to see which values are missing in the other column. For example, when I filter the Name column and select, let's say, 'James', I want to display that James doesn't operate in Tokyo.

I have used this topic https://community.powerbi.com/t5/Desktop/Using-EXCEPT-with-ALLEXCEPT-and-ALLSELECTED/m-p/581386 to create a measure that allows me to display the unfiltered values but only from the same column which I am filtering. The other issue with it is that it only works if I concatenate the values, while I'd rather have them in a table.

Essentially I am looking to create a measure that reverses the effect of the filter and displays the unfiltered values from the second column instead of the filtered ones.

Is this possible?

 

Below is my sample dataset. 


https://drive.google.com/file/d/1002OfyczIpSnVpxNWNHZk1VPcWK64oCw/view?usp=sharing

 

Thanks a bunch!

2 ACCEPTED SOLUTIONS
v-yanjiang-msft
Community Support
Community Support

Hi @datagnan ,

According to your description, I download your sample, here's my solution.

Create a measure.

Missing2 =
VAR _T =
    SELECTCOLUMNS (
        FILTER ( ALL ( 'my_data' ), 'my_data'[Name] = SELECTEDVALUE ( my_data[Name] ) ),
        "City", [City]
    )
RETURN
    CONCATENATEX ( EXCEPT ( ALL ( 'my_data'[City] ), _T ), [City], "," )

Get the expected result.

vkalyjmsft_0-1644918648664.png

I attach the sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

datagnan
Frequent Visitor

@v-yanjiang-msft  Thanks a bunch, yes your solution totally works for concatenating the unfiltered values. 

I was looking to display them in a table, so I also figured out a solution for that as below:

Created a table with unique values for each 'City' and created a normal relationship (1 to *) with the fact table (my_data), then added 'City' to a table visual.

 

AllNames = VALUES(my_data[City])

Created 3 measures in 'my_data':

filteredCityCount = CALCULATE(COUNTROWS(DISTINCT(my_data[City])))

totalCities = CALCULATE(DISTINCTCOUNT(my_data[City]),ALL(my_data))


finalFilter =
IF ( [totalCities] - [filteredCityCount] = [totalCities], 1, 0)

Added finalFilter = 1 as a filter to the table visual. I've updated the sample pbix file in the opening post with both solutions.

pbi.gif

 










View solution in original post

4 REPLIES 4
datagnan
Frequent Visitor

@v-yanjiang-msft  Thanks a bunch, yes your solution totally works for concatenating the unfiltered values. 

I was looking to display them in a table, so I also figured out a solution for that as below:

Created a table with unique values for each 'City' and created a normal relationship (1 to *) with the fact table (my_data), then added 'City' to a table visual.

 

AllNames = VALUES(my_data[City])

Created 3 measures in 'my_data':

filteredCityCount = CALCULATE(COUNTROWS(DISTINCT(my_data[City])))

totalCities = CALCULATE(DISTINCTCOUNT(my_data[City]),ALL(my_data))


finalFilter =
IF ( [totalCities] - [filteredCityCount] = [totalCities], 1, 0)

Added finalFilter = 1 as a filter to the table visual. I've updated the sample pbix file in the opening post with both solutions.

pbi.gif

 










v-yanjiang-msft
Community Support
Community Support

Hi @datagnan ,

According to your description, I download your sample, here's my solution.

Create a measure.

Missing2 =
VAR _T =
    SELECTCOLUMNS (
        FILTER ( ALL ( 'my_data' ), 'my_data'[Name] = SELECTEDVALUE ( my_data[Name] ) ),
        "City", [City]
    )
RETURN
    CONCATENATEX ( EXCEPT ( ALL ( 'my_data'[City] ), _T ), [City], "," )

Get the expected result.

vkalyjmsft_0-1644918648664.png

I attach the sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

CNENFRNL
Community Champion
Community Champion

Did you ever hear what ADIDAS says? Impossible is nothing.

Spend more time writing mockup dataset and expected result if you want to learning something or even to get a free solution to your question.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

I have uploaded the pbix file with the data and the measure I have worked on, as outlined in the best practices. What is your problem exactly?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.