Forum Discussion
Creating new column based on value from another table
- 1 year ago
You could create a calculated DAX Column on table 2 for this. You would could create an ID for your code ranges and add them to your table1. Then with your caclulated column calculate what ID to assign each row and then relate the ID of table1 to the calculated ID of table2 Something like:
VAR RowID = Table2[ID]
VAR FilteredTable =
FILTER('Table1',
AND('Table1'[StartCode] <= RowID,
'Table1'[EndCode] >=RowID
)
)
VAR Result =
CALCULATE(
DISTINCT('Table1'[IDRangeKey]), FilteredTable)
RETURN ResultOnce that is created you can access that info column through the newly created relationship
- 1 year ago
Hi,
Please check the below picture and the attached pbix file.
expected result CC = SUMMARIZE ( FILTER ( Table1, Table1[START CODE] <= Table2[ID] && Table1[END CODE] >= Table2[ID] ), Table1[INFO] ) - 1 year ago
Hi hugomatos
Can you please try the below DAX.New Column =VAR MatchingRow =FILTER(table1,Table1[START CODE ] <= Table2[ID] &&Table2[ID] <= Table1[END CODE ])RETURNMAXX(MatchingRow, Table1[INFO])
If you have found your answer, please mark it as the solution.
You could create a calculated DAX Column on table 2 for this. You would could create an ID for your code ranges and add them to your table1. Then with your caclulated column calculate what ID to assign each row and then relate the ID of table1 to the calculated ID of table2 Something like:
VAR RowID = Table2[ID]
VAR FilteredTable =
FILTER('Table1',
AND('Table1'[StartCode] <= RowID,
'Table1'[EndCode] >=RowID
)
)
VAR Result =
CALCULATE(
DISTINCT('Table1'[IDRangeKey]), FilteredTable)
RETURN Result
Once that is created you can access that info column through the newly created relationship