Forum Discussion
How to change measure value using parameters?
- 10 years ago
rajdsing You cannot have a dropdown but you can use slicers or filters to change the calculations on chart.
You need to create a table that hols the values which you want to show in the slicer
Calculation Name SortID Cost 1 Quantity 2 Weight 3
The SortID is there for sorting the values in slicer as also use it to change the calculation.
The calculations are fictional, change it to your own measures. No relantionship is needed betwwen the calculation name table and any other.
The measure can be like this
Variable Calculation = VAR Costs = SUM ( Sales[Cost] ) //Change with your measure VAR Quantitys = SUM ( Sales[Quantity] ) //Change with your measure VAR Weights = SUM ( Sales[Weight] ) //Change with your measure VAR SelectMeasure = MIN ( CalculationTable[SortID] ) RETURN IF ( HASONEVALUE ( CalculationTable[Calculation Name] ); SWITCH ( SelectMeasure; 1; Costs; 2; Quantitys; 3; Weights ) )Add the [Variable Calculation] measure to any graph and add as filter of slicer the values from the table Calculation Names.
This should work
*Note that you cannot change the format based on selection ( at least not I am aware of )
rajdsing You cannot have a dropdown but you can use slicers or filters to change the calculations on chart.
You need to create a table that hols the values which you want to show in the slicer
Calculation Name SortID Cost 1 Quantity 2 Weight 3
The SortID is there for sorting the values in slicer as also use it to change the calculation.
The calculations are fictional, change it to your own measures. No relantionship is needed betwwen the calculation name table and any other.
The measure can be like this
Variable Calculation =
VAR Costs =
SUM ( Sales[Cost] ) //Change with your measure
VAR Quantitys =
SUM ( Sales[Quantity] ) //Change with your measure
VAR Weights =
SUM ( Sales[Weight] ) //Change with your measure
VAR SelectMeasure =
MIN ( CalculationTable[SortID] )
RETURN
IF (
HASONEVALUE ( CalculationTable[Calculation Name] );
SWITCH ( SelectMeasure;
1; Costs;
2; Quantitys;
3; Weights
)
)
Add the [Variable Calculation] measure to any graph and add as filter of slicer the values from the table Calculation Names.
This should work
*Note that you cannot change the format based on selection ( at least not I am aware of )
What a great solution. Thanks for sharing this.