Search code examples
powerbiuniondaxselectedvalue

Union table to itself with propagated filter


I'm new to Power BI and DAX, so bear with me.

I needed to union a table to itself when it is filtered. I need the filter from DimCompanySupplier[VAT] to propagate to InterestCategory[VAT] and union the result set from both filtered tables, all from the first input filter.

I am struggling to find the solution, I would really appreciate it if you could help me.

OpportunitiesByVAT =
VAR SelectedVat = SELECTEDVALUE ( DimCompanySupplier[VAT]; "ALL" )
RETURN
    UNION (
        CALCULATETABLE ( FactActiveOpportunities; DimCompanySupplier[VAT] = SelectedVat );
        CALCULATETABLE ( FactActiveOpportunities; InterestCategory[VAT] = SelectedVat )
    )

Thanks in advance!


Solution

  • Addressing your underlying problem to this question, your difficulty appears to be that you want a slicer that works using OR logic rather than AND logic.

    Fortunately, this has been answered before. Please refer to this post:

    Power BI Dashboard where the core filter condition is a disjunction on numeric fields