Forum Discussion
gnotcirdec
4 years agoFrequent Visitor
Comparing latitude and longitude in a table against different table of latitude and longitudes
Hello. I'm trying to compare data points in different tables to see if they are within each other. If tableA latitude and longitude are inside any of the points inside fence indicated by tableB, ...
- 4 years ago
Hi gnotcirdec
Here is a DAX method. You can create a new column with below code.
Is Inside = VAR _table = ADDCOLUMNS ( TableB, "IsInsideFlag", IF ( TableA[Latitude] >= TableB[BottomLatitude] && TableA[Latitude] <= TableB[TopLatitude] && TableA[Longitude] >= TableB[TopLongitude] && TableA[Longitude] <= TableB[BottomLongitude], 1, 0 ) ) RETURN IF ( COUNTROWS ( FILTER ( _table, [IsInsideFlag] = 1 ) ) >= 1, 1, 0 )Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. - 4 years ago
Try changing the last line of [Is Inside] to
MINX ( FILTER ( _table, [IsInsideFlag] = 1 ), [Location] )
gnotcirdec
4 years agoFrequent Visitor
Hi v-jingzhang ,
Is there a way to modify the solution to include Text as the result?
For example:
Any help would be appreciated!
Thanks,
Cedric
AlexisOlson
Super User
4 years agoTry changing the last line of [Is Inside] to
MINX ( FILTER ( _table, [IsInsideFlag] = 1 ), [Location] )