Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Following this article:
https://community.powerbi.com/t5/Desktop/How-to-change-measure-value-using-parameters/td-p/46011
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 ) )
And how can i format those values in the DAX return?
Example:
50
IF the choice is Price, the value must be seen with brazilian coin format (R$ 50,00).
IF the choice is Quantity, the value must be seen like 50,00
IF the choice is weight, the value must be seen like 50,0000
How can i do that?
Thank's for all!
Solved! Go to Solution.
There would be no way to comingle differing field types within a DAX result field (...that I can think of...).
Instead one would have math only in your primary field, then include a 2nd field/column with a Type indicator value/flag.
Then one could calculate a 3rd column/field that creates a text value (because R$ symbols) based upon these 2 field values.
....and this is just thinking out loud - - could be more issues when it comes to implementation logic.....
You can use the FORMAT function in your switch statement. However, FORMAT returns blank text when the value is blank so you will end-up facing issues with blanks being reported (blank won't be suppressed as it's a blank string not a BLANK()) in many places. You need to include visual level filters to exclude blank in all the places.
It's frustrating not to set the format string dynamically (e.g. scope statements in SSAS multi-dimensional) hopefully this gets addressed in the future releases.
Soo, i think this will not be possible to make =/
Serious, in tableau this is SO MUCH EASY TO MAKE, the tool already understand what format should use, every field have a ID, why power bi don't understand the format when the field is setting in the sum()?
''hopefully this gets addressed in the future releases.'' ME 2.
There would be no way to comingle differing field types within a DAX result field (...that I can think of...).
Instead one would have math only in your primary field, then include a 2nd field/column with a Type indicator value/flag.
Then one could calculate a 3rd column/field that creates a text value (because R$ symbols) based upon these 2 field values.
....and this is just thinking out loud - - could be more issues when it comes to implementation logic.....
User | Count |
---|---|
125 | |
108 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |