Forum Discussion

connelvalentine's avatar
connelvalentine
New Member
1 year ago
Solved

A Common Modelling Scenario That Got Me Stumped

I have not found any place which answers this seemingly common scenario.   Say it's the travel industry and my fact table has travel itineraries with the Origin Airport and Destination Airport as s...
  • johnt75's avatar
    1 year ago

    For REQ1 you could add any fields you wanted to display into the fact table, e.g. Arrival Name, Dest Name, Arrival Code, Dest Code.

    For filtering the measures you could have a single, disconnected, airports table and create a calculation group with a calculation item like

    Airport Filter =
    VAR SelectedAirports =
        VALUES ( Airports[Code] )
    VAR Result =
        CALCULATE (
            SELECTEDMEASURE (),
            KEEPFILTERS ( 'Fact'[Arrival Code]
                IN SelectedAirports
                    || 'Fact'[Destination Code] IN SelectedAirports )
        )
    RETURN
        Result
    

    Use this as a filter on any visuals where you want that behaviour, or potentially as a report level filter if you want it  everywhere.