Forum Discussion
Subtract two columns with Many to Many Relationship - Likely Measure
Hi USABB_Data -you could create a bridge table with distinct Item # if needed, but that depends on your data structure. one more, If you are working on large datasets, it's crucial to avoid calculated columns or using RELATED in a many-to-many scenario, as it can lead to performance degradation.
Instead, keep calculations in measures to allow DAX to perform calculations dynamically based on filters.
Below is the measure for example:
Price Match Discount Measure =
IF (
ISFILTERED('Discount'[Discount Name]),
CALCULATE(
IF (
ABS(SUM('Sales Detail'[Price]) - SUM('Discount'[Item_Price])) < 0.01,
"Y",
"N"
),
FILTER(
'Sales Detail',
'Sales Detail'[Item #] IN VALUES('Discount'[Item #])
)
),
BLANK()
)
Hope this helps
Thanks for the suggestion. This did not return the correct results and was non-performant when added to a table visual with other columns.