cancel
Showing results for
Did you mean:
Frequent Visitor

## calculate a measure using a double column filter

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Regular Visitor

## Re: calculate a measure using a double column filter

@danielvarela92

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

3 REPLIES 3
Highlighted
Regular Visitor

## Re: calculate a measure using a double column filter

@danielvarela92

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

Frequent Visitor

## Re: calculate a measure using a double column filter

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

Regular Visitor

## Re: calculate a measure using a double column filter

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.

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 101 members 1,433 guests
Recent signins: