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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How do I append the results of multiple filters for the same table?

Hello guys, I am having an issue with some dynamic filtering on a table, and I am asking for your help to make this work.

 

So here is the problem described:

I have a Table A, for which I am applying 2 different filtering measures:

Measure 1 = Calculate(DistinctCount(Table A [col X], Filter(Table A, expression 1)));

Measure 2 = Calculate(DistinctCount(Table A [col X], Filter(Table A, expression 2)));

 

What I would like to do:

Measure 3 = Calculate(DistinctCount(Table A [col X], Append(Filter 1 Result, Filter 2 Result)); - or something like this.

 

The reason I want to do this:

I have to count the distinct value from both of the result sets and I cannot reunite the logic inside expression 1 and 2, and I am trying to rule out rows that could appear as a result for both expressions.

 

Am I overthinking something, or is there no way? If there is, can anyone suggest one please?

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@v-chuncz-msft thank you for looking into my matters!

 

In the end I managed to get a solution to my problem. I had to use a function I've never used before, but it could be useful to anybody out there so I'm going to explain what I did:

 

I took the results from the two filterings and I assigned them to a VAR each using the CALCULATETABLE function. I then used the COUNTROWS function on a DISTINCT of the two VARs' UNION. It worked like a charm! 

 

I hope this comes in handy to anyone out there! Smiley Very Happy

View solution in original post

4 REPLIES 4
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

It seems that you may simply use the logical OR operator (||).

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-chuncz-msft, it would be really cool for it to be that easy, but the problem is that the 2 expressions are pointed at 2 different contexts of the same table:

M1's filter: Filter(All(Table A), expression 1)));

M2's filter: Filter(Table A, expression 2)));

 

Which means that for the expression 1 and 2, I cannot use a simple OR, because the ALL refers to the whole table, whereas the second refers to the selected values based on the filters set to a report level.

 

Or is there a way to implement an OR statement prior to that?

@Anonymous,

 

You may add UNION Function.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-chuncz-msft thank you for looking into my matters!

 

In the end I managed to get a solution to my problem. I had to use a function I've never used before, but it could be useful to anybody out there so I'm going to explain what I did:

 

I took the results from the two filterings and I assigned them to a VAR each using the CALCULATETABLE function. I then used the COUNTROWS function on a DISTINCT of the two VARs' UNION. It worked like a charm! 

 

I hope this comes in handy to anyone out there! Smiley Very Happy

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors