Forum Discussion
sambgv
2 years agoHelper I
Adding sums from two measures
Classification Team Role Date Value ID_ X A Mechanic 07-Feb 1 A_Mechanic_Feb X B Fireman 07-Feb 1 B_Fireman_Feb X C Doctor 07-Feb 1 C_Doctor_Feb X Pool Baker 0...
- Anonymous2 years ago
Hi sambgv ,
Here are the steps you can follow:
1. Create measure.
Question1 = var _SupplyTable= SUMX(FILTER(ALL('Supply Table'),YEAR('Supply Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Supply Table'[Date])=MONTH(MAX('Supply Table'[Date]))&&'Supply Table'[Team]<>"Pool"),[Value]) var _DemandTable= SUMX(FILTER(ALL('Demand Table'),YEAR('Demand Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Demand Table'[Date])=MONTH(MAX('Supply Table'[Date]))),[Value]) return _SupplyTable - _DemandTableQuestion2 = SUMX(FILTER(ALL('Supply Table'),YEAR('Supply Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Supply Table'[Date])=MONTH(MAX('Supply Table'[Date]))&&'Supply Table'[Team]="Pool"),[Value])Question3 = var _Pool= SUMX( FILTER('Supply Table',[Team]="Pool"),[Value]) var _Supply= SUMX( 'Supply Table',[Value]) var _Demand= SUMX( FILTER('Demand Table', YEAR('Demand Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Demand Table'[Date])=MONTH(MAX('Supply Table'[Date]))),[Value]) return _Pool + (_Supply - _Demand)2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
sambgv
2 years agoHelper I
the first requirnment is solved ( i think) by the following dax formula :
SUM( 'Supply' [Value] ) - SUM ('Supply' [Value])
2). I just :
CALCULATE (
Supply[Value],
TeamName = Pool
)
3). i tried adding these measure. and it works, but i can't add classification in the legend of the bar chart, since Classification is only in the supply table. i tried to add a column classification in the demand table, but it created dups in the bridge table, which cannot be since the bridge table is on the one side of the relationship