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

DISTINCTCOUNT with filters from multiple tables.

Hello folks,

I'm struggling to create a measure where I have the Number of Tenancies (cases), where the Account Class is 'REN', the In Arreas is 'Y', and the Current Former is 'C'.

The problem is that the Account Class comes from a different table and I'm unsure how to filter it.

Couldn't find anything on YT or solutions in here that could help me to solve this.

 

1st try.

ROG_BI22_0-1650900289768.png
2nd try.

ROG_BI22_1-1650901173550.png

 

Thank you!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 

you may try

No Current Arrears Cases (REN) =
CALCULATE (
    DISTINCTCOUNT ( 'Account Balance Weekly'[DTE_TENANCY_NO] ),
    'Account Balance Weekly'[DTE_CURRENT_FORMER] = "C",
    'Account Balance Weekly'[FAB_IN_ARREARS] = "Y",
    FILTER ( 'Rent Account', 'Rent Account'[Account_Class] = "REN" )
)

View solution in original post

6 REPLIES 6
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

I briefly simulated some data that I hope will fit your situation.

Measure:

No Current Arrears Cases = 
CALCULATE (
    DISTINCTCOUNT ( 'Account Balance Weekly'[DTE_TENANCY_NO] ),
    FILTER ('Account Balance Weekly',
        'Account Balance Weekly'[DTE_CURRENT_FORMER] = "C"
            && 'Account Balance Weekly'[FAB_IN_ARREARS] <> "Y"
    ),
    FILTER ( 'Rent_Account', Rent_Account[Account Class] = "REN" )
)

Table: Rent_Account

vzhangti_0-1651132906684.png

Table: Account Balance Weekly

vzhangti_2-1651132969123.png

Shouldn't the number of cases that you want to calculate without outstanding payments not be equal to "Y"? If "Y" has other meanings, you can also calculate it as you understand it. If you want to filter multiple tables, you may need to add an additional Filter.

 

Best Regards,

Community Support Team _Charlotte

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

v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

Has your problem been solved, if so, please consider Accept a correct reply as the solution. If not, can you share some of the sample data for testing?

 

Best Regards,

Community Support Team _Charlotte

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

tamerj1
Super User
Super User

Hi @Anonymous 

you may try

No Current Arrears Cases (REN) =
CALCULATE (
    DISTINCTCOUNT ( 'Account Balance Weekly'[DTE_TENANCY_NO] ),
    'Account Balance Weekly'[DTE_CURRENT_FORMER] = "C",
    'Account Balance Weekly'[FAB_IN_ARREARS] = "Y",
    FILTER ( 'Rent Account', 'Rent Account'[Account_Class] = "REN" )
)
Anonymous
Not applicable

Thank you so much @tamerj1 

amitchandak
Super User
Super User

@Anonymous , Do not use && or || between different tables, By default it is end

 

In the second one just give comma after "Y" and remove &&

Anonymous
Not applicable

Understood, @amitchandak 

Your option also works, so could you please tell me which option is best in this case?
With FILTER function or just doing what you said above?

Thank you so much.

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.

Top Solution Authors