Forum Discussion
Creating a measure based off the relationship between two different columns and another table
Hi ajc96 -Compare the current benefit to the previous product’s benefits using CONTAINS or a similar DAX function.
Create measure:
IsNewBenefit =
VAR currentProductID = SELECTEDVALUE(contractProducts[product_id])
VAR previousProductID = SELECTEDVALUE(contractProducts[previous_product_id])
VAR currentBenefit = SELECTEDVALUE(productBenefits[benefit_name])
-- Get the benefits of the previous product
VAR previousProductBenefits =
CALCULATETABLE(
VALUES(productBenefits[benefit_name]),
productBenefits[product_id] = previousProductID
)
-- Check if the current benefit exists in the previous product's benefits
VAR isNewBenefit =
IF(
NOT CONTAINS(previousProductBenefits, productBenefits[benefit_name], currentBenefit),
"Yes", -- Benefit is new
"No" -- Benefit exists in the previous product
)
RETURN isNewBenefit
Let me know if this works for your setup, if any please share more references and details.