cancel
Showing results for
Did you mean:
Highlighted
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
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
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

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

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

#### Power Platform Summit North America

Register by September 5 to save \$200

#### Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 287 members 2,776 guests
Recent signins: