Forum Discussion

SteenSoernesen's avatar
SteenSoernesen
Frequent Visitor
1 year ago
Solved

Measurements with filter from a different tables

I'm trying to make a conutrow where I need infomations from a different tables to get the correkt count numbers for different aspects like aflyst(cancelled), forsinket(delayed), On Time, Planlagt afl...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi SteenSoernesen ,
    Instead, you can use LOOKUPVALUE() in your measure to determine if the station is a measuring point (Maalepunkt = TRUE). For example -

    Canceled_Events :=
    CALCULATE(
       COUNTROWS(Fact_Events),
       Fact_Events[Status] = "aflyst",
       LOOKUPVALUE(
           Dim_Stationer[Maalepunkt],
           Dim_Stationer[TogNr], Fact_Events[TogNr],
           Dim_Stationer[Stop navn], Fact_Events[Stop navn]
       ) = TRUE()
    )

    This formula matches the train number and station name from the fact table to the dimension table, filtering for rows where Maalepunkt is true. You can apply this approach to other statuses such as forsinket, planmaessig, and others.