- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
calculate a measure using a double column filter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2018 07:58 AM
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.
Accepted Solutions
Re: calculate a measure using a double column filter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2018 02:03 PM
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
Slicer are values from the disconnected table
All Replies
Re: calculate a measure using a double column filter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2018 02:03 PM
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
Slicer are values from the disconnected table
Re: calculate a measure using a double column filter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-03-2018 08:29 AM
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..
Re: calculate a measure using a double column filter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-03-2018 08:50 AM
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.