Forum Discussion
Dynamic comparison of values
- 1 year ago
Fanis_Georg So perhaps something like this:
Current vs. Standard = VAR __Material = MAX( 'Table'[Material] ) VAR __TableCurrent = FILTER( ALL( 'Table' ), [ResultPeriod] = "Current" ) VAR __TableSTD = FILTER( ALL( 'Table' ), [ResultPeriod] = "STD" ) VAR __Current = SUMX( __TableCurrent, [Costing] ) VAR __STD = SUMX( __TableSTD, [Costing] ) VAR __Result = __Current - __STD RETURN __Result
Fanis_Georg So perhaps something like this:
Current vs. Standard =
VAR __Material = MAX( 'Table'[Material] )
VAR __TableCurrent = FILTER( ALL( 'Table' ), [ResultPeriod] = "Current" )
VAR __TableSTD = FILTER( ALL( 'Table' ), [ResultPeriod] = "STD" )
VAR __Current = SUMX( __TableCurrent, [Costing] )
VAR __STD = SUMX( __TableSTD, [Costing] )
VAR __Result = __Current - __STD
RETURN
__Result
- Fanis_Georg1 year agoRegular Visitor
Greg_Deckler your solution seems to be working but I come across another issue now. When I enter the calculate measure to my matrix i would expect a result like with 4 columns, CP-1, Current, STD, Current vs Standard. Instead i have the following, CP-1, Current vs Standard, Current, Current vs Standard, Standard, Current vs Standard. So basicaly the Current vs Standard calculated measure repeats after each and every column of the matrix.
- Greg_Deckler1 year agoCommunity Champion
Fanis_Georg Yeah, that's the joy of working with matrix visuals in Power BI. You have 2 options basically. Make everything a measure, so CP-1, Current, STD you would all make measures and then use all measures for the columns in your matrix. The other way is a custom matrix hierarchy:
The New Hotness (Custom Matrix Hierarchy) - Microsoft Fabric Community
- Fanis_Georg1 year agoRegular Visitor
Greg_Deckler Thank you, indeed. I created new measures for each period and it worked. Thanks