Forum Discussion

gvg's avatar
gvg
Post Prodigy
8 years ago
Solved

Using two or more USERELATIONSHIPs

Hi experts,   I am trying to sum Quantity by GroupName in the following relationship scenario. Tables are related via the same name fields.     This is simplified part of a much more compl...
  • OwenAuger's avatar
    8 years ago

    Hi gvg

     

    From the tables/relationships you've shown, you should just activate the two relationships simultaneously.

     

    The measure should look something like:

     

    =
    CALCULATE (
        SUM ( Sales[Quantity] ),
        USERELATIONSHIP ( Sales[Product], Subgroup[Product] ),
        USERELATIONSHIP ( Subgroup[SubgroupName], Group[SubgroupName] )
    )

     

    You can also use the CROSSFILTER function with the same effect:

     

     

    =
    CALCULATE (
        SUM ( Sales[Quantity] ),
        CROSSFILTER ( Sales[Product], Subgroup[Product], OneWay ),
        CROSSFILTER ( Subgroup[SubgroupName], Group[SubgroupName], OneWay )
    )

    Owen :)