The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello everyone.
I'm a relatively new user, and I'd like your help with this problem.
I have a table visual, where the first column is the names of the Customers in my base, and 4 measures, I'll call them A, B, C and D.
So far, I've come up with the following DAX measure for 😧
D =
VAR _B = [B]
VAR _C = [C]
VAR _D =
SWITCH(
TRUE(),
OR(_C < 0, _B < 0), 0,
_C > _D, 0,
_C - _B
)
RETURN
_D
The calculation works, but I need to add up the values that are not zero in the total row, and I believe that due to the logic of the calculation this doesn't happen.
Could someone help me with this problem?
Thanks in advance.
Solved! Go to Solution.
Hi @Ferhyox - Create a measure to handle the total row and ensure it only sums non-zero values as below:
D =
SUMX(
VALUES('CustomerTable'[CustomerName]),
VAR _B = [B]
VAR _C = [C]
VAR _D = _C - _B
RETURN IF(_D < 0, 0, _D)
)
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
Hi @Ferhyox - Create a measure to handle the total row and ensure it only sums non-zero values as below:
D =
SUMX(
VALUES('CustomerTable'[CustomerName]),
VAR _B = [B]
VAR _C = [C]
VAR _D = _C - _B
RETURN IF(_D < 0, 0, _D)
)
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
I only made a small adaptation by changing the IF for a SWITCH to add some validations, but your suggestion worked perfectly.
Thank you very much @rajendraongole1 ! 😁