Forum Discussion

MattJessop's avatar
MattJessop
Frequent Visitor
7 years ago
Solved

Filter a measure by two columns

I want to filter a calculated table by two different categories, to find the closest category based off the minimum distance.   The calculated table is: How I want to pull the results togeth...
  • LivioLanzo's avatar
    LivioLanzo
    7 years ago

    Hello MattJessop

     

    Below is one solution to your scenario:

     

     

     

    =
    COUNTROWS (
        FILTER (
            GENERATE (
                VALUES ( Persons[Person] ),
                CALCULATETABLE ( TOPN ( 1, Data, Data[Distance], ASC ), ALL ( Locations ) )
            ),
            Data[Location] IN VALUES ( Locations[Location] )
        )
    )