Forum Discussion
DAX - Dynamic Measure based on slicer selection
- 4 years ago
Get the lat, long of the site in the same fashion:
VAR IDLat = SELECTEDVALUE(EventTable[Lat])
VAR IDLong = SELECTEDVALUE(EventTable[Long])
VAR SiteLat = SELECTEDVALUE(SitesTable[Lat])
VAR SiteLong = SELECTEDVALUE(SitesTable[Long])
then apply your formulae.
If this does not work I'd probablyn need a mock pbix reproducing the issue so that I can see exactly what you are doing. You have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).
Please accept the solution when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Hi MischaT
The distance between the selected ID and where?
You can read the selected ID coordinates simply by using:
VAR IDLat = SELECTEDVALUE(EventTable[Lat])
VAR IDLong = SELECTEDVALUE(EventTable[Long])
and then use that in hte formula you already have
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
- MischaT4 years agoFrequent Visitor
Hi @AlB,
Thank you for the response.
I have tried using the SELECTEDVALUE, but unfortunately it still doesn't work.
I would like to calculate the distance from the selected ID to each of the ISITES.
When an ID is then selected, the distance calculation then does not work correctlyVahidDM, DB_ISITES Table:
SITE NAME TYPE PROV LAT LONG Tropical Bar GP -29,33850 27,99473 Sunset Casino KZN -29,33840 31,28890 I'm very confused as to what is going wrong
Thank you!
- AlB4 years agoCommunity Champion
Get the lat, long of the site in the same fashion:
VAR IDLat = SELECTEDVALUE(EventTable[Lat])
VAR IDLong = SELECTEDVALUE(EventTable[Long])
VAR SiteLat = SELECTEDVALUE(SitesTable[Lat])
VAR SiteLong = SELECTEDVALUE(SitesTable[Long])
then apply your formulae.
If this does not work I'd probablyn need a mock pbix reproducing the issue so that I can see exactly what you are doing. You have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).
Please accept the solution when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.