Forum Discussion
Calculation Group
Calculation groups in Tabular Editor can be a great way to achieve this.
First, you'll need to create a calculation group using Tabular Editor. Let's call this calculation group "Measure Switcher".
Next, add a column to this calculation group, let's call it "Measure Selection". This column will have two values: "Use IMP_CE" and "Use IMP_TRUE".
Now, for the magic part. In the calculation items of the calculation group, you'll define the logic to switch between the two measures based on the selection.
For the "Use IMP_CE" calculation item, the expression would be something like:
SWITCH(
SELECTEDVALUE('Measure Switcher'[Measure Selection]),
"Use IMP_CE", [IMP_CE],
"Use IMP_TRUE", [IMP_TRUE],
[IMP_CE] // default value
)
This logic checks the selected value in the "Measure Switcher" table and returns either IMP_CE or IMP_TRUE based on the selection.
Now, when you want to calculate ROE or any other measure, you can use this logic:
ROE =
DIVIDE(
SWITCH(
SELECTEDVALUE('Measure Switcher'[Measure Selection]),
"Use IMP_CE", [Income from IMP_CE],
"Use IMP_TRUE", [Income from IMP_TRUE],
[Income from IMP_CE] // default value
),
[Equity]
)
With this setup, you can use a slicer in Power BI based on the "Measure Selection" column from the "Measure Switcher" table. When you select "Use IMP_CE", all your measures will use the IMP_CE values, and when you select "Use IMP_TRUE", they'll use the IMP_TRUE values.