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
Gazi
Frequent Visitor

ALLEXCEPT for non directly related tables

Hi community!

 

I am stuck with calculating AVG count of children in hierarchy 😞 

 

My DAX code example (for 1 Level):

AVG AA = 
IF (
    [BrowseDepth] = 1,
    CALCULATE (
        COUNTA ( ArticleAttribute[ArticleAttributeID] ),
        ALLEXCEPT ( ArticleAttribute, StuctureGroupHierarchy[Level 1] )
    )
        / CALCULATE ( DISTINCTCOUNT ( StuctureGroupHierarchy[Level 2] ) )

But DAX throws this error: 

Capture4.JPG

 

 

I have 4 tables:

Capture5.JPG

 

 

Mapping_table       Article table 

ArticleRevisionID *:1 ArticleRevisionID

 

Article table          ArticleAttribute table 

ArticleRevisionID 1:* ArticleRevisionID

 

 

Please help! 

Gazi

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi Gazi ,

 

A simple way is to merge ArticleAttribute, Acticle and Mapping.Table as a new table then create one-many relationship between StructureGroupHierarchy and the new table.

 

Regards,

Jimmy Tao

View solution in original post

3 REPLIES 3
v-yuta-msft
Community Support
Community Support

Hi Gazi ,

 

A simple way is to merge ArticleAttribute, Acticle and Mapping.Table as a new table then create one-many relationship between StructureGroupHierarchy and the new table.

 

Regards,

Jimmy Tao

v-yuta-msft
Community Support
Community Support

Hi Gazi

 

In your diagram, table 'StuctureGroupHierarchy' and table 'Mapping_table' has one-many relationship, table 'Mapping_table' and table 'Article' is  many-one relationship so that 'StuctureGroupHierarchy' and 'Article' is many-many relationship, so relationship between 'StuctureGroupHierarchy' and 'ArticleAttribute' can be one-many.

 

In addtion, as the error shows, table in the second param shoud be one-many or one-one relationship with table in the first param. So you should create a one-many relationship between the two tables.

 

Regards,

Jimmy Tao

Hi Jimmy! @v-yuta-msft

 

Thank you for your reply! Can you please specify how can I create that one-many relationship you said??

I've tried to think about it, but apparently I am not getting something...

 

Thank you a lot!!

 

Gazi

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.