Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Reply
Natascha_D
Regular Visitor

Question about DAX Formula with positiv and negativ counts

hello,

i have a problem with my dax formula.

In my matrix, I have a column with negative and positive values (actual numbers) and a column with target values (sums). My dax formula calculates the negative values (-values) correctly, but it always adds the positive values, because minus and minus gives plus, the formulas had to be like this for the negative values.

For the positive values, however, I can't manage to convert the formula correctly so that it subtracts the actual target values: Solution_time_plus_target =
IF(
SUMX(‘complete report FMIT Helpdesk’, ‘complete report FMIT Helpdesk’[FM solution time TARGET]) >= 0,
SUM(‘complete report FMIT Helpdesk’[resolution time final]) + SUMX(‘complete report FMIT Helpdesk’, ‘complete report FMIT Helpdesk’[FM resolution time TARGET]),
SUM(‘complete report FMIT Helpdesk’[FM resolution time TARGET]) -
SUMX(
‘complete report FMIT Helpdesk’,
IF(
‘complete report FMIT Helpdesk’[resolution time final] < 0,
‘complete report FMIT Helpdesk’[resolution time final],
0
)
)
)

 

Maybe one of you knows the correct answert. Thank you for helping. Natascha

10 REPLIES 10
Natascha_D
Regular Visitor

C = my mistake, sorry!

Natascha_D
Regular Visitor

Already the same problem. the result of the positive values is correct, the negative values are still added in my file

Natascha_D_0-1726751487928.png

 

@bhanu_gautam 

bhanu_gautam
Super User
Super User

@Natascha_D , Try using below measure

 

Solution_time_plus_target =
SUMX(
'complete report FMIT Helpdesk',
IF(
'complete report FMIT Helpdesk'[FM solution time TARGET] >= 0,
'complete report FMIT Helpdesk'[resolution time final] - 'complete report FMIT Helpdesk'[FM solution time TARGET],
'complete report FMIT Helpdesk'[resolution time final] + 'complete report FMIT Helpdesk'[FM solution time TARGET]
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi @bhanu_gautam 

Thank you very much for your answer. I tried but the positive values get allready wrong. The system make the addition not the subtraktion....

@Natascha_D , Can you share sample data




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Natascha_D_0-1726551927905.png

@bhanu_gautam Here we go 🙂

@bhanu_gautam Hello, i want friendly ask have you any idea? BR, Natascha

@Natascha_D , Please find the attached PBI file and sample data is working on below logic can you check if it is correct or not

 


resolution time final FM solution time TARGET Expected Result
10 5 5
-8 3 -11
15 7 8
-12 -4 -16
20 10 10
-5 -2 -7




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thank you very much.
The result is not correct. I am trying to make it clearer.
Sum of fm solution time target is always a positive value, which must be subtracted with positive or negative values
e.g. Assigen A = correct
assigne B = incorrect, should be - 5
assigne C = incorrect, should be -8
does this make it clearer? can you help me?

In C both are positive than how can it be -8 , I have updated as per logic of B




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors