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

Find Duplicate Count of related Table

Here's the situation,

 

I have two tables with a 1 to Many relationship: Location and Asset.  I'm looking to find and flag TRUE or FALSE locations that have multiple Assets of the same Size and of the same Material.  See Below for table examples.  

 

Asset Table

 

Asset IDLocation NumberSizeMaterial
223412341Wood
223512341Wood
223612342Wood
223712354Carpet
223812361Carpet
223912361Wood
224012363Carpet
224112371Wood

 

Location Table

 

Location NumberRelated to Multiple Assets of the same Type
1234TRUE
1235FALSE
1236FALSE
1237FALSE
1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @HansTheEnforcer 

I would propose creating a calculated column like this in Location:

 

Related to Multiple Assets of the same Type =
CALCULATE (
    MAXX (
        SUMMARIZE ( Asset, Asset[Material], Asset[Size] ),
        CALCULATE ( COUNTROWS ( Asset ) )
    )
) > 1

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

3 REPLIES 3
OwenAuger
Super User
Super User

Hi @HansTheEnforcer 

I would propose creating a calculated column like this in Location:

 

Related to Multiple Assets of the same Type =
CALCULATE (
    MAXX (
        SUMMARIZE ( Asset, Asset[Material], Asset[Size] ),
        CALCULATE ( COUNTROWS ( Asset ) )
    )
) > 1

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

This worked perfectly!  Thank you!

VasTg
Memorable Member
Memorable Member

@HansTheEnforcer 

 

Try this as a calculated column in Location Table.

 

Column =
VAR A =
    RELATEDTABLE ( 'Asset Table' )
VAR SIZE_CNT =
    CALCULATE ( DISTINCTCOUNT ( 'Asset Table'[Size] ), A )
VAR MATERIAL_CNT =
    CALCULATE ( DISTINCTCOUNT ( 'Asset Table'[Material] ), A )
RETURN
    IF ( SIZE_CNT > 1, FALSE (), IF ( MATERIAL_CNT > 1, FALSE (), TRUE () ) )

 

If this helps, mark it as a solution.

Kudos are nice too

Connect on LinkedIn

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.