Forum Discussion
MattJessop
7 years agoFrequent Visitor
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...
- 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] ) ) )
LivioLanzo
Solution Sage
7 years agoHello 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] )
)
)
MattJessop
7 years agoFrequent Visitor
Thanks for this! Sorry for late response, I've been on holiday last few weeks. Will need to have a play around with this but looks good to me.