Forum Discussion
Multiply Table by a Reference Table With Conditions
- 2 years ago
Hey Anonymous ,
this is my measure:
Measure = sumx( 'Main Table' , var currentLocation = [Location] var currentCondition = [Condition ] return 'Main Table'[Value] * CALCULATE( SUM( 'Reference Table Unpviot A & B'[Value] ) , 'Reference Table Unpviot A & B'[Location] = currentLocation , 'Reference Table Unpviot A & B'[Attribute] = currentCondition ) )This is a simple Matrix visual (build by the columns of the Main table):
Please check the expected result for Location Uptown and Condition A, it seems the provided data does not match with the expected result.
You can not create a measure that reacts on different columns, at least not if you want the solution fully dynamic, independent of the "number" of conditions, for this reason I use the unpivoted table, but do not try to create any relationship.
Please be aware that in my solution the Main Table and the "Reference Table Unpivot ..." are not related, this are the only two table of the model:
Hopefully, this provides what you are looking for.Regards,
Tom
Hey Anonymous ,
this is my measure:
Measure =
sumx(
'Main Table'
, var currentLocation = [Location]
var currentCondition = [Condition ]
return
'Main Table'[Value]
*
CALCULATE( SUM( 'Reference Table Unpviot A & B'[Value] )
, 'Reference Table Unpviot A & B'[Location] = currentLocation
, 'Reference Table Unpviot A & B'[Attribute] = currentCondition
)
)
This is a simple Matrix visual (build by the columns of the Main table):
Please check the expected result for Location Uptown and Condition A, it seems the provided data does not match with the expected result.
You can not create a measure that reacts on different columns, at least not if you want the solution fully dynamic, independent of the "number" of conditions, for this reason I use the unpivoted table, but do not try to create any relationship.
Please be aware that in my solution the Main Table and the "Reference Table Unpivot ..." are not related, this are the only two table of the model:
Hopefully, this provides what you are looking for.
Regards,
Tom
That got it TomMartens ! Thanks an absolute ton!