Forum Discussion
Giada90
4 years agoHelper IV
problem with a calculation
Hi,
I have a table with two fields like this:
| type | value |
| A | 10 |
| B | 3 |
I need to make a measure that subtracts value A from value B
Which dax formula can I use?
Thanks
Giada90 try this
Measure 2 = var _A = CALCULATE(SUM('Yourtable'[value]),'Yourtable'[type] = "A")
var _B = CALCULATE(SUM('Yourtable'[value]),'Yourtable'[type] = "B")
return
(_A - _B)thanks!
11 Replies
- Pragati11Super User
Hi Giada90 ,
You can create a DAX expression to get this done.
But before that you will need to add an Index column to your data.
I am not sure on how big is your data?
You haven't mentioned if you need to do this subtraction at you type column level or something else? This information is needed to understand whether you have multiple rows for same type.
Please provide atleast 5-10 rows in your sample data, to cover all the scenarios.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523