Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
SpartakO1
Helper I
Helper I

Dynamic variation

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 SaleTotal Amount Price per unitMarginVariant of simulation
480012008.044%Rev1
486913458.146%Rev2
680017897.642%Rev3
489489239.354%Rev4
1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

 

v-yangliu-msft_0-1610419194700.jpeg

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.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

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

 

v-yangliu-msft_0-1610419194700.jpeg

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.

SpartakO1
Helper I
Helper I

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

aj1973
Community Champion
Community Champion

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.