Forum Discussion
How to Dynamically Filter Table B Based on Parameters in Table A Using DAX?
It does help me resolve the first issue but does not address the second one.
FilteredTableB =
VAR DistinctParameters = VALUES(TableA[parameter])
VAR FilterConditions =
ADDCOLUMNS(
DistinctParameters,
"Condition",
SWITCH(
TRUE(),
TableA[parameter] = "a", TableB[a] = TableA[value],
TableA[parameter] = "b", TableB[b] = TableA[value],
TableA[parameter] = "c", TableB[c] = TableA[value],
FALSE
)
)
VAR FilteredB =
FILTER(
TableB,
COUNTROWS(
FILTER(
FilterConditions,
[Condition]
)
) = COUNTROWS(DistinctParameters)
)
RETURN
FilteredB
DistinctParameters: This variable gets the unique parameters from Table A.
FilterConditions: This variable creates a table where each row contains a condition based on the parameter. For example, if the parameter is “a”, it checks if TableB[a] equals the value in Table A.
FilteredB: This variable filters Table B by applying the conditions.
Let me know if that works.
If my post helps, then please consider Accept it as the solution to help the other members find it more quickly. Kudos are always appreciated.