Forum Discussion
Make a value as negative depending on a parameter from another table
- 5 years ago
Tybaal , something like this
if (max('Dimension Type'[Type]) = "A", SUM('Fact sales'[Amount]) * -1, IF('Dimension Type'[Type] = "B", SUM('Fact sales'[Amount])))
or
sumx(values('Dimension Type'[Type]) ,if ('Dimension Type'[Type] = "A", SUM('Fact sales'[Amount]) * -1, IF('Dimension Type'[Type] = "B", SUM('Fact sales'[Amount]))))
Tybaal , something like this
if (max('Dimension Type'[Type]) = "A", SUM('Fact sales'[Amount]) * -1, IF('Dimension Type'[Type] = "B", SUM('Fact sales'[Amount])))
or
sumx(values('Dimension Type'[Type]) ,if ('Dimension Type'[Type] = "A", SUM('Fact sales'[Amount]) * -1, IF('Dimension Type'[Type] = "B", SUM('Fact sales'[Amount]))))
Thank you amitchandak , it works with your first proposition :
if (max('Dimension Type'[Type]) = "A", SUM('Fact sales'[Amount]) * -1, IF(max('Dimension Type'[Type] = "B", SUM('Fact sales'[Amount])))
But can you explain why it didn't work without the 'max'? (sorry i'm a beginner in DAX)