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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
vjnvinod
Impactful Individual
Impactful Individual

Divide function returning Postive %

Hi,

 

i have encountered a strange situation, i have used this formula

Margin% = DIVIDE(Data[FYTD Margin],Data[FYTD ANSR])
 
my values are below, and its returning 270.9%, instead of -270.9%, is there any fix to it?
FYTD Margin
-203183.13

 

FYTD ANSR

-75144.86
 
 
1 ACCEPTED 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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

9 REPLIES 9
PhilipTreacy
Super User
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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Singaravelu_R
Resolver III
Resolver III

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

 

Column = if(DIVIDE('Table (5)'[FYTD Margin],'Table (5)'[FYTD ANSR],0)>0,DIVIDE('Table (5)'[FYTD Margin],'Table (5)'[FYTD ANSR],0)*(-1),DIVIDE('Table (5)'[FYTD Margin],'Table (5)'[FYTD ANSR],0)*(1))
PhilipTreacy
Super User
Super User

@vjnvinod 

If you require the result to always be positive wrap the calculation in ABS

Margin% = ABS(DIVIDE(Data[FYTD Margin],Data[FYTD ANSR]))

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@PhilipTreacy 

 

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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@PhilipTreacy

worked like a charm, awesome

Fowmy
Super User
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 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

vjnvinod
Impactful Individual
Impactful Individual

@Fowmy 

 

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 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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