Forum Discussion
Measure controlled by Dimension
I do this frequently. I have a table called MeasureBehavior. In it is a single column, MeasureType. There are no relationships between this and other tables.
| MeasureType |
| Actual |
| Budget |
Maybe you'd have more rows if you wanted more measure swapping. "Loss", "Projection" etc.
I don't know what your data model is like but let's imagine you have a table called BudgetTable and a table called ActualTable, both with Amount columns that you want to sum up. Further, I'm going to assume that if neither "Actual" nor "Budget" is selected, or if more than of them is selected, you want this measure to do nothing at all, return blank. If not, substitute whatever you want it to do for both of the BLANK()s below.
Value = IF( HASONEVALUE(MeasureBehavior[MeasureType]), SWITCH( FIRSTNONBLANK(MeasureBehavior[MeasureType], 1), "Actual", SUM(ActualTable[Amount]), "Budget", SUM(BudgetTable[Amount]), BLANK() ), BLANK() )
If you already have measures written for Actual Value and Budget Value, substitute references to them for the SUM parts above.
Thanks for the reply - in your example, how would you plot (within PowerBI) a guage that showed Actual versus Budget?
cheers
Chris
- Anonymous9 years agoNot applicable
I thought you were asking for a gauge that you could control with a slicer, where it would switch between showing actual and budget. If you want to plot actual against budget on a gauge, why would you not just write a measure for actual and a measure for budget, then put them both on the gauge?
- chrisbev9 years agoNew Member
Agreed - the issue is that we already have a cube with the measures developed the way they have been, we can use this method within Pyramid Analytics as it allows that granularity of selection but did wonder if
a) PowerBI could handle it and
b) Whether many other people constructed their measures this way
cheers
Chris