Forum Discussion
gvg
8 years agoPost Prodigy
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...
- 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 :)
OwenAuger
8 years agoSuper User
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 :)
gvg
8 years agoPost Prodigy
Thanks! It works. Except that Groups table name should be in quotes ('Groups') as it probably represents DAX keyword.