Forum Discussion
jasanlea
2 years agoRegular Visitor
Subtract two total num values from same column using a filter from other column in the same table
Hi everyone, I am really new using PowerBi and I am trying to find the way to create a measure using DAX code to receive the result of subtracting two total num values from same column using a fi...
- 2 years agoHi jasanlea ,Please note that below measure will remove all filters on table and calculate sum for reference value =1 and 2 and subtract them. If it is something else you want then please explain in detail.testtable4-----------ReferenceValue2024
1 5 2 3 Measure------------Measure Sub =VAR _refVal1 = CALCULATE(SUM(TestTable4[2024]), REMOVEFILTERS(TestTable4[ReferenceValue]), TestTable4[ReferenceValue] = 1)VAR _refVal2 = CALCULATE(SUM(TestTable4[2024]), REMOVEFILTERS(TestTable4[ReferenceValue]), TestTable4[ReferenceValue] = 2)return IF(HASONEFILTER(TestTable4[ReferenceValue]), SELECTEDVALUE(TestTable4[2024]), _refVal1 - _refVal2)
lbendlin
Super User
2 years agoPlease provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523