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

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.

Reply
Anonymous
Not applicable

DAX - calculate with filter in diferent tables

Hello guys,
I´m trouble because I can´t create some analysis that use to be comum to do in SQL

 

1) I need to do a measure that distinctcount CPF from table A and test if the same CPF is in the table B and C 

2) I need to do other mesasure similar the last one, but now, I need count CPF from table A that exists in table C but not in table B

 

modelo.PNG

 

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

Hi, @Anonymous 

 

According to your description, you can try the following formulas:

 

1) You want to distinct count CPF in Table A that also exists in CPF in Table B and C.

CPF in B&C =
CALCULATE (
    DISTINCTCOUNT ( A[CPF] ),
    FILTER ( A, [CPF] IN VALUES ( B[CPF] ) && A[CPF] IN VALUES ( C[CPF] ) )
)

 

2)You want to distinct count CPF in Table A that exists in Table C but not in Table B

CPF in C NOT B =
CALCULATE (
           DISTINCTCOUNT ( A[CPF] ),
         FILTER ( A, [CPF] IN VALUES ( C[CPF] ) && NOT ( A[CPF] IN VALUES ( B[CPF] ) ) )
)

 

Best, Regards,

Paul Zheng

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

Hi, @Anonymous 

 

According to your description, you can try the following formulas:

 

1) You want to distinct count CPF in Table A that also exists in CPF in Table B and C.

CPF in B&C =
CALCULATE (
    DISTINCTCOUNT ( A[CPF] ),
    FILTER ( A, [CPF] IN VALUES ( B[CPF] ) && A[CPF] IN VALUES ( C[CPF] ) )
)

 

2)You want to distinct count CPF in Table A that exists in Table C but not in Table B

CPF in C NOT B =
CALCULATE (
           DISTINCTCOUNT ( A[CPF] ),
         FILTER ( A, [CPF] IN VALUES ( C[CPF] ) && NOT ( A[CPF] IN VALUES ( B[CPF] ) ) )
)

 

Best, Regards,

Paul Zheng

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @V-pazhen-msft 
Thanks a lot for your help.
I really apreciated your solution. It´s simple and clear. It´s works perfectly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.