Forum Discussion

sureshcu's avatar
sureshcu
Helper I
8 years ago
Solved

Apply Discount to Total

Hi,   I am trying to get Final Value after deducting discount. I have written the followig measure which is not working. Can anyone correct it   Discount Apply = SUMX(Orders,Orders[Sales]*Orders[...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Can you clarify, do you mean that the discount column is a number representing a percentage from 1 to 100?

     

    If so, you'll need to convert this to a number between 0 and 1 - 0 being 0%, 1 being 100%. To do that, just divide by 100. For a discount of 26%, do [Discount]/100 e.g. 26 / 100 = 0.26

     

    There are a couple ways of getting the discounted amount now, but I'd just flip the discount percent around to get the discounted percentage with 1-[Discount Percent] e.g. 1 - 0.26 = 0.74

     

    Now we can just multiply the sale by the discounted percent to get the discounted cost: [Sales] * [Quantity] * [Discount Percent]

    e.g. $5 * 12 = $60, so $60 * 0.74 = $44.40

     

    So you can do it in steps, or do it all in the one measure, where the final thing should look something like 

    Discount Apply = SUMX(Orders,Orders[Sales]*Orders[Quantity] * (1-(Order[Discount]/100)) )
  • sureshcu's avatar
    sureshcu
    8 years ago

    Hi Tamasys,

     

      your solution works. Thanks for your help.