Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Tackle Many to many relationship ?

Hello everyone,   I'm working on a tableau migration, and in tableau I have one report to migrate, in this report, the following measure is create:   sum([Threshold Value]*[Weight])/SUM(IIF(ISNUL...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Anonymous ,

     

    The RELATED function only works in many-to-one or one-to-one relationships because it is designed to return a single value. In a many-to-many relationship, there may be multiple related values and it is impossible to determine which value to return.

     

    Since you created the relationship, you can calculate it directly without creating a calculated column by creating a measure, you can write it as:

    DIVIDE (
        SUM ( 'BridgeTable'[the calculated column'] ) * SUM ( 'tab_weight'[weight] ),
        IF (
            MAX ( 'tab_indicators'[value] ) = BLANK (),
            0,
            SUM ( 'tab_weight'[weight] )
        )
    )
    

     

    If the problem persists, can you provide .pbix file with sensitive data removed or a portion of each table to help the problem be resolved more quickly?

     

    Best Regards,
    Zhu
    Community Support Team

     

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