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.
hi, I have a data set like this :
activities | main area | country |
activity 1 | X | A |
activity 1 | X | B |
activity 1 | Y | A |
activity 1 | Y | B |
activity 2 | W | A |
activity 2 | W | B |
activity 2 | W | C |
activity 2 | W | D |
activity 2 | Y | A |
activity 2 | Y | B |
activity 2 | Y | C |
activity 2 | Y | D |
activity 3 | Z | E |
activity 3 | Z | F |
activity 3 | W | E |
activity 3 | W | F |
activity 3 | X | E |
activity 3 | X | F |
activity 3 | Y | E |
activity 3 | Y | F |
activity 3 | V | E |
activity 3 | V | F |
and i have to solve this question: which countries have proyects with X,Y,and Z main areas (AND ,not or, thats the reason why a conventional slicer cant help me) ...so i know that i have to filter first by country and in this filtered escenario i must evaluate if there are at least three rows with the three main areas im looking for...but i dont know how..can anyone help me? PLEASEEEE
Solved! Go to Solution.
@Anonymous
First create a table based on the one you showed with just the areas to serve as a filter.
Main Areas = values(Table1[main area])
Don't connect it to your existing table.
Create the following measure:
Match = VAR CountryAreas = CALCULATETABLE ( VALUES ( Table1[main area] ); ALLEXCEPT ( Table1; Table1[country] ) ) VAR filterAreas = VALUES ( 'Main Areas'[main area] ) VAR MatchingAreas = INTERSECT ( CountryAreas; filterAreas ) RETURN IF ( COUNTROWS ( filterAreas ) = COUNTROWS ( MatchingAreas ); "Match"; "No Match" )
You should get this result
@Anonymous
First create a table based on the one you showed with just the areas to serve as a filter.
Main Areas = values(Table1[main area])
Don't connect it to your existing table.
Create the following measure:
Match = VAR CountryAreas = CALCULATETABLE ( VALUES ( Table1[main area] ); ALLEXCEPT ( Table1; Table1[country] ) ) VAR filterAreas = VALUES ( 'Main Areas'[main area] ) VAR MatchingAreas = INTERSECT ( CountryAreas; filterAreas ) RETURN IF ( COUNTROWS ( filterAreas ) = COUNTROWS ( MatchingAreas ); "Match"; "No Match" )
You should get this result
Genius!
thank you! it works.
Just another question: there is a way to show only the activities that match with the main area selection? ...because in this case the table is showing all the activities in the countries that match....
thank you again..
If I understood your question you can do this:
Match = VAR CountryAreas = CALCULATETABLE ( VALUES ( Table1[main area] ); ALLEXCEPT ( Table1; Table1[country] ) ) VAR filterAreas = VALUES ( 'Main Areas'[main area] ) VAR MatchingAreas = INTERSECT ( CountryAreas; filterAreas ) RETURN IF ( COUNTROWS ( filterAreas ) = COUNTROWS ( MatchingAreas ); IF ( ISEMPTY ( INTERSECT ( VALUES ( Table1[main area] ); filterAreas ) ); "No Match"; "Match" ); "No Match" )
Here, a new condition was added to check if the current record has a filtered area.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |