Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
shamishanc
Frequent Visitor

Help with using measures to filter geo results

I have three tables that I want to get talking with one another:

  1. Member geographic information (geolocated)
  2. Census Sub-Division data (geolocated)
  3. Province/Territory index (acts as bridge for relationships with other two tables)

 

I also have a formula that calculates distance between two points (that I took from another post in this community - thanks!):

 

Distance_From_Members = 
var Lat1 = MIN('Members'[Latitude])
var Lng1 = MIN('Members'[Longitude])

var Lat2 = MIN('Census'[latitude])
var Lng2 = MIN('Census'[longitude])
---- Algorithm here -----
var P = DIVIDE( PI(), 180 )
var A = 0.5 - COS((Lat2-Lat1) * p)/2 + 
    COS(Lat1 * p) * COS(lat2 * P) * (1-COS((Lng2- Lng1) * p))/2
var final = 12742 * ASIN((SQRT(A)))
return final

So far, I'm able to create a table visualization that lists all of the members within x kilometers of a census sub-division. I end up with a table that looks something like this:

 

Census Subdivision | Province | Member | Distance

Toronto                  | Ontario  | Member 1 | 25.4

Toronto                  | Ontario  | Member 2 | 16.2

Montreal                | Quebec  | Member 3 | 24.2

Montreal                | Quebec  | Member 4 | 52.4

 

...and so on, to the point where I can't even export the data to Excel because the dataset is too large (I tried doing provincial slices, but no dice, so to speak).

 

I get lossy data if I try to show a member count instead of a list, or even if I only ask for the first member for each census subdivision.

 

Also, I can only visualize the data in this way. I'm not sure how to use the measure as a filter to apply to other visualizations (I understand measures can't be used as filters and I'm not sure how to create Calculated Tables using measures to filter what makes it into the table). I would love to be able to slice the data in a number of ways based on the distance between communities and members.

 

I would appreciate any guidance you can offer.

1 ACCEPTED SOLUTION
shamishanc
Frequent Visitor

Just as an update - I solved this problem quite easily (so much for giving up :P).

 

I used the following formula:

 

NewTable = CROSSJOIN(Table1,Table2)

 

Simple as that. I then built my distance measure into that new table, and then turned the measure results into a static value with:

 

NewColumn = DistanceMeasure

There was some tweaking (I had to create new column headers for some fields, but ultimately it was a painless process.

View solution in original post

1 REPLY 1
shamishanc
Frequent Visitor

Just as an update - I solved this problem quite easily (so much for giving up :P).

 

I used the following formula:

 

NewTable = CROSSJOIN(Table1,Table2)

 

Simple as that. I then built my distance measure into that new table, and then turned the measure results into a static value with:

 

NewColumn = DistanceMeasure

There was some tweaking (I had to create new column headers for some fields, but ultimately it was a painless process.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.