Forum Discussion

seanjmorris's avatar
seanjmorris
Regular Visitor
4 years ago
Solved

Clustered Bar Chart with Unpivoted Data - Combining Two Types of Data

Hello  I have a single table (See "Activities by lead agency") that has information about which agency is the lead and any other agencies that are involved. In order to make the second green graph I...
  • AlexisOlson's avatar
    AlexisOlson
    4 years ago

    Keep the unpivoted table (you can get rid of the other one) and create a relationship from Agency to LeadAgency and another (inactive) relationship from Agency to InvolvedAgency.

     

    The CountLead measure stays the same but the SumInvolved has to activate the inactive relationship:

    SumInvolved =
    VAR CurrAgency = VALUES ( dimAgency[Agency] )
    RETURN
        CALCULATE (
            SUM ( Unpivoted[Value] ),
            Unpivoted[Involved Agency] IN CurrAgency,
            USERELATIONSHIP ( Unpivoted[Involved Agency], DimAgency[Agency] )
        )