powerbipowerquerydashboard

power bi division variable measure


I need to create a measure that performs a division in a way or another depending on if the amounts of sales and budget are positive or negative. The desired output will be something like what you can see in the image and the division will be:

I can't find a way to make it work properly. I have tried function divide(sales,budget)-2 but it's not dynamic so the results are incorrect.

Thanks.

enter image description here


Solution

  • % = DIVIDE('Table'[SALES],'Table'[BUDGET]) + IF(OR(SIGN('Table'[BUDGET])=-1,SIGN('Table'[SALES])=-1),-2,0)
    

    enter image description here