Reputation: 143
I have a fact which has relationships with 2 dimension tables.
I have created a sum measure that should sum up the Amount column.
I have created two queries that don't give me the expected result
Query 1:
Sum of Amount:= CALCULATE(SUM(Fact[Amount]))
Current result : The Grand total is 600
Query 2:
Sum of Amount:= IF(HASONEVALUE('Dimension 1'[value]),CALCULATE(SUM(Fact[Amount])),
SUMX(VALUES('Dimension 1'[value]),CALCULATE(SUM(Fact[Amount]))))
Current result : The Grand Total is 400
Expected result : When the Dimension 1 is selected, the grand total should be 400 and when the Dimension 2 selected the Grand total should be 600.
Could anyone please help me to achieve this?
Upvotes: 0
Views: 484
Reputation: 4877
The answer is that it is not possible to have a measure that behaves differently on the totals when in the visual a different dimension is selected on the rows.
This happens because when evaluating the totals there is no filter on the dimension.
It would be like having a measure that can give two different results when no dimension is selected, for instance in a card visual.
SO answer is to implement two separate measures.
Otherwise to select the behavior using a slicer on a parameter table, or to use a calculation group.
Upvotes: 1