Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Using COALESCE breaks joins

Hi,   I've a stupid problem: when I try to use COALESCE on a mesure in order to force a value when there is no data, I end up with a cartesian product when there are multiple tables linked.   Sim...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    I think your table visual should be expanded by relationship. I suggest you to try to use virtual table in your code.

    New Measure:

    ImpQty = 
    VAR _SUMMARIZE =
        ADDCOLUMNS (
            Country,
            "Capacity", RELATED ( Capital[Capital] ),
            "Qty", CALCULATE ( SUM ( 'Import'[Qty] ) ) + 0
        )
    RETURN
        SUMX ( _SUMMARIZE, [Qty] )

    Result is as below.

    Best Regards,
    Rico Zhou

     

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