Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
i have encountered a strange situation, i have used this formula
-203183.13 |
FYTD ANSR
-75144.86 |
Solved! Go to Solution.
Hi @vjnvinod
Try this
Margin% = SWITCH( TRUE(),
SIGN(Data[FYTD Margin]) = -1 || SIGN(Data[FYTD ANSR]) = -1 , ABS(DIVIDE(Data[FYTD Margin],Data[FYTD ANSR])) * -1,
DIVIDE(Data[FYTD Margin],Data[FYTD ANSR])
)
Regards
Phil
Proud to be a Super User!
Hi @vjnvinod
Great, glad to help.
Can you please mark my answer as the solution so we know this qs has been answered.
Thanks
Phil
Proud to be a Super User!
Hi @vjnvinod ,
Could you please try with if function as mentioned below. I think it gives the result which is the way you want. Please try and let us know
If you require the result to always be positive wrap the calculation in ABS
Margin% = ABS(DIVIDE(Data[FYTD Margin],Data[FYTD ANSR]))
Phil
Proud to be a Super User!
Actually not
if either of them is negative or both of them are negative, my value should show negative, thats the logic
is there any solution you can recommend?
Hi @vjnvinod
Try this
Margin% = SWITCH( TRUE(),
SIGN(Data[FYTD Margin]) = -1 || SIGN(Data[FYTD ANSR]) = -1 , ABS(DIVIDE(Data[FYTD Margin],Data[FYTD ANSR])) * -1,
DIVIDE(Data[FYTD Margin],Data[FYTD ANSR])
)
Regards
Phil
Proud to be a Super User!
@vjnvinod
It is correct, when you divide minus value by another minus value, you get a positive answer.
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
I understand that, but from a business perspective its not correct, i want to see my result in negative in those cases where one of them or both of them are negative
Hope i am making sense
@vjnvinod
Try this measure and modify as per your variations:
Margin% =
var margin = Data[FYTD Margin]
var ansr = Data[FYTD ANSR]
return
IF( Data[FYTD Margin] <0 || Data[FYTD ANSR] < 0,
ABS(DIVIDE(Data[FYTD Margin],Data[FYTD ANSR])) * -1,
DIVIDE(Data[FYTD Margin],Data[FYTD ANSR])
)
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
67 | |
51 | |
38 | |
26 |
User | Count |
---|---|
89 | |
52 | |
45 | |
39 | |
38 |