Forum Discussion
Structure setup suggestions - values across two columns
- 4 years ago
I would approach this by creating a star schema consisting of a dimension table with one row for each Driver/Porter (this table will contain unique names; if your data has an Employee ID or equivalent, use this column to ensure uniqueness). Then, create two relationships between the dimension table and fact table; one relationship will use the fact table Driver column, and the other relationship will use the fact table Porter column. It doesn't matter which relationship is active (one is active, one is inactive). In this example, the Driver column has the active relationship.
Create the following measures:
Driver Total = SUM ( FactTable[AmountColumn] )Porter Total = CALCULATE ( SUM ( FactTable[AmountColumn] ), USERELATIONSHIP ( DimensionTable[Name], FactTable[Porter] ) )In a visual, use the dimension table Name column.
I would approach this by creating a star schema consisting of a dimension table with one row for each Driver/Porter (this table will contain unique names; if your data has an Employee ID or equivalent, use this column to ensure uniqueness). Then, create two relationships between the dimension table and fact table; one relationship will use the fact table Driver column, and the other relationship will use the fact table Porter column. It doesn't matter which relationship is active (one is active, one is inactive). In this example, the Driver column has the active relationship.
Create the following measures:
Driver Total =
SUM ( FactTable[AmountColumn] )
Porter Total =
CALCULATE (
SUM ( FactTable[AmountColumn] ),
USERELATIONSHIP ( DimensionTable[Name], FactTable[Porter] )
)
In a visual, use the dimension table Name column.