Forum Discussion
Related table - Calculated column
- 9 years ago
Hi tragonneau,
I also verified that we may not be able to use RELATED function to create calculate columns in Direct Query mode currently. However, you should be able to use RELATED function to create a measure in Direct Query mode in your scenario.
As the RELATED function requires a row context to work correctly, you need to create a row context inside a DAX expression by using iterators(SUMX, FILTER etc.). The formula below is for your reference.:smileyhappy:
Measure = IF ( HASONEVALUE ( Table2[id] ), IF ( CALCULATE ( COUNTROWS ( Table2 ) = 1, FILTER ( Table2, RELATED ( Table1[deal_type] ) = "Sell" ) ), VALUES ( Table2[sell_destination] ), VALUES ( Table2[buy_destination] ) ) )Regards
Hi tragonneau,
I also verified that we may not be able to use RELATED function to create calculate columns in Direct Query mode currently. However, you should be able to use RELATED function to create a measure in Direct Query mode in your scenario.
As the RELATED function requires a row context to work correctly, you need to create a row context inside a DAX expression by using iterators(SUMX, FILTER etc.). The formula below is for your reference.:smileyhappy:
Measure =
IF (
HASONEVALUE ( Table2[id] ),
IF (
CALCULATE (
COUNTROWS ( Table2 ) = 1,
FILTER ( Table2, RELATED ( Table1[deal_type] ) = "Sell" )
),
VALUES ( Table2[sell_destination] ),
VALUES ( Table2[buy_destination] )
)
)
Regards