Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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[Quantity]-Orders[Discount])
Discount column is number. need to apply %.
Solved! Go to Solution.
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)) )
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)) )
Hi Tamasys,
your solution works. Thanks for your help.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |