Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Date | Val1 | Val2 | Difference | Absolute Value Difference |
1/1/2018 | 0 | 6 | -6 | 6 |
1/2/2018 | 6 | 5 | 1 | 1 |
1/3/2018 | 7 | 2 | 5 | 5 |
Total | 18 | 13 | 0 | 12 |
How do I write a DAX Formula to get 12 (The Absolute Value Difference SUMMED BY DAYS) as my desired output instead of 0?
This is the calculation and result I am getting currently:
ABS(Sum(Val1)) - ABS(Sum(Val2)) = 0
Solved! Go to Solution.
Use ABS only once, after subtracting the two sums
...
CALCULATE(
ABS( SUM('auditModelMessageCount'[Axeda ABC]) - SUM('auditModelMessageCount'[Raw Message History]) )
) ...
It depends on your table structure and you have t said if you have one or more tables. Assuming one table, this should work
SUMX(VALUES(table[Date]),CALCULATE(abs(sum(val1))-abs(sum(val2))))
you can learn about sum vs sumx in power BI at this link.
Matt,
Thanks for the quick response. My result is still 0 with that formula (see below in context). To answer question about data structure.... all my columns are from 1 table like you correctly assummed from the example above.
Test1 = SUMX(
VALUES('auditModelMessageCount'[auditDate]),
CALCULATE(
ABS(SUM('auditModelMessageCount'[Axeda ABC])) - ABS(SUM('auditModelMessageCount'[Raw Message History]))
)
)
Use ABS only once, after subtracting the two sums
...
CALCULATE(
ABS( SUM('auditModelMessageCount'[Axeda ABC]) - SUM('auditModelMessageCount'[Raw Message History]) )
) ...
THANK YOU! THAT WORKS!
Test1 = SUMX(
VALUES('auditModelMessageCount'[auditDate]),
CALCULATE(
ABS(
SUM('auditModelMessageCount'[Axeda ABC]) - SUM('auditModelMessageCount'[Raw Message History])
)
)
)
Yeah, I just copied the OP formula and assumed there was some reason it was that way. Obviously not 🙂
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
91 | |
84 | |
76 | |
65 |
User | Count |
---|---|
145 | |
109 | |
109 | |
102 | |
96 |