Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello everyone,
I trying to simplify the calculations for the following data:
need to calculate the variation between the different simulation, just to prevent creating measures each time we create a new simulation.
How can I get a way to dynamically choose a simulation to compare with another one?
thank you!
| Total Sale | Total Amount | Price per unit | Margin | Variant of simulation |
| 4800 | 1200 | 8.0 | 44% | Rev1 |
| 4869 | 1345 | 8.1 | 46% | Rev2 |
| 6800 | 1789 | 7.6 | 42% | Rev3 |
| 4894 | 8923 | 9.3 | 54% | Rev4 |
Solved! Go to Solution.
Hi @SpartakO1 ,
Here are the steps you can follow:
You can use the selectvalue function to calculate the field data corresponding to the two data when you select two data in the variant of simulation
For example:
Select Rev1 and rev2, and compare the price per unit corresponding to Rev1 with the price per unit corresponding to rev2
1. Create measure
compara =
var _min=MIN('Table (2)'[Variant of simulation])
var _max=MAX('Table (2)'[Variant of simulation])
return
CALCULATE(SUM('Table (2)'[Price per unit]),FILTER(ALL('Table (2)'),'Table (2)'[Variant of simulation]=_max))
-
CALCULATE(SUM('Table (2)'[Price per unit]),FILTER(ALL('Table (2)'),'Table (2)'[Variant of simulation]=_min))2. Result
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @SpartakO1 ,
Here are the steps you can follow:
You can use the selectvalue function to calculate the field data corresponding to the two data when you select two data in the variant of simulation
For example:
Select Rev1 and rev2, and compare the price per unit corresponding to Rev1 with the price per unit corresponding to rev2
1. Create measure
compara =
var _min=MIN('Table (2)'[Variant of simulation])
var _max=MAX('Table (2)'[Variant of simulation])
return
CALCULATE(SUM('Table (2)'[Price per unit]),FILTER(ALL('Table (2)'),'Table (2)'[Variant of simulation]=_max))
-
CALCULATE(SUM('Table (2)'[Price per unit]),FILTER(ALL('Table (2)'),'Table (2)'[Variant of simulation]=_min))2. Result
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thank you for your time, let me explain better the problem, i have to compare Rev1 with Rev2 or Rev3 and vice versa.
I'm not sure if parameters can help in this specific case
Hi @SpartakO1
In my understanding you need to use parameters feature of power BI
https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/
https://www.youtube.com/watch/iiNDq2VrZPY
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 137 | |
| 102 | |
| 68 | |
| 66 | |
| 64 |