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.
Hi hugomatos,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution so that other community members can find it easily.
Thank you.
Hi hugomatos,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.