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.
Hello everyone
I setup 2 "What If" paramaters to let user to choose %discount of product A and B. When user choose discount, I would like to get these %discount to silumate sales. The problem is I cannot match each parameter to product in table, so I cannot calculate sales using %discount choose by user. I also attach picture to make more clear. Please kindly advise. Thank you very much.
Sobsawat S.
Solved! Go to Solution.
Hi @sobsawats,
Based on my test, you can refer to below steps:
1.I have entered some sample data to test for your problem like the picture below:
2.
Create two “What If” parameters and three measures.
Discount = IF(CALCULATE(MAX([Product])="A"),[A Value]/100,IF(CALCULATE(MAX([Product])="B"),[B Value]/100))
New price = CALCULATE(SUM(Table1[List Price]))-(CALCULATE(SUM(Table1[List Price]))*[Discount])
New sales = CALCULATE(SUM(Table1[Sales]))-(CALCULATE(SUM(Table1[Sales]))*[Discount])
3.Create a Table visual and add the related fields and you can see the result.
You can also download the PBIX file to have a view.
Regards,
Daniel He
Hi @sobsawats,
Based on my test, you can refer to below steps:
1.I have entered some sample data to test for your problem like the picture below:
2.
Create two “What If” parameters and three measures.
Discount = IF(CALCULATE(MAX([Product])="A"),[A Value]/100,IF(CALCULATE(MAX([Product])="B"),[B Value]/100))
New price = CALCULATE(SUM(Table1[List Price]))-(CALCULATE(SUM(Table1[List Price]))*[Discount])
New sales = CALCULATE(SUM(Table1[Sales]))-(CALCULATE(SUM(Table1[Sales]))*[Discount])
3.Create a Table visual and add the related fields and you can see the result.
You can also download the PBIX file to have a view.
Regards,
Daniel He
It's work. Thank you so much.
Note:
I change IF to SWITCH to shorten formula in case I have many many product in the list.
Discount2 = SWITCH(CALCULATE(MAX([Product])),"A",[A Value]/100,"B",[B Value]/100)
Hello @v-danhe-msft
Thank you for your reply.The key is MAX().
I will study your solution and provided material, and will feed back soon.
Thanks again,
Sobsawat S.
Hi @sobsawats,
Ok, if your problem has been solved, could you please mark my helpful reply as Answered?
Regards,
Daniel He
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 |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |