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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

trying to correct the Latitude and longitude data

hello everyone.

i am trying to correct the latitude and longitude data in the power query but i am not finding a dax function for it.

susanpalliparam_0-1648060377384.png

i would like to correct the data by making it exact, meaning i am trying to get the accurate date which would look like this.

susanpalliparam_1-1648060530770.png

within excel i am able to do it without any issue i used the formual 

 =LEFT(D2,2)+(MID(D2,3,2)+MID(D2,5,6)/60)/60 (latitude ) and for long =-1*(LEFT(E2,2)+(MID(E2,3,2)+MID(E2,5,6)/60)/60), but i don't think i can use the same formula in power BI in the dax , so kindly tell me how i can do it ?
 
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can add two custom columns in Power Query Editor with below code.

Number.IntegerDivide([latitude],10000)+(Number.IntegerDivide(Number.Mod([latitude],10000),100)+Number.RoundDown(Number.Mod([latitude],100),0)/60)/60
(Number.IntegerDivide([longitude],10000)+(Number.IntegerDivide(Number.Mod([longitude],10000),100)+Number.RoundDown(Number.Mod([longitude],100),0)/60)/60)*(-1)

vjingzhang_0-1648544847368.png

Result

vjingzhang_1-1648544883569.png

 

Hope this helps.

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

5 REPLIES 5
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can add two custom columns in Power Query Editor with below code.

Number.IntegerDivide([latitude],10000)+(Number.IntegerDivide(Number.Mod([latitude],10000),100)+Number.RoundDown(Number.Mod([latitude],100),0)/60)/60
(Number.IntegerDivide([longitude],10000)+(Number.IntegerDivide(Number.Mod([longitude],10000),100)+Number.RoundDown(Number.Mod([longitude],100),0)/60)/60)*(-1)

vjingzhang_0-1648544847368.png

Result

vjingzhang_1-1648544883569.png

 

Hope this helps.

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Anonymous
Not applicable

i will work on it and do the needful 

Anonymous
Not applicable

thank you

 

 

KNP
Super User
Super User

I'm not sure how your decimals shifted in the first place in the lat/long data but DAX is not really the correct place to do this data modelling. You should use Power Query (Transform Data).

 

Paste this into the advanced editor of a blank query...

// Table
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjE1NDUy1zMzMlHSUTIzMzAyNdAzsDBSio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [lat = _t, long = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"lat", type number}, {"long", type number}}),
    #"Divided Column" = Table.TransformColumns(#"Changed Type", {{"lat", each _ / 10000, type number}}),
    #"Divided Column1" = Table.TransformColumns(#"Divided Column", {{"long", each _ / 10000, type number}}),
    #"Multiplied Column" = Table.TransformColumns(#"Divided Column1", {{"long", each _ * -1, type number}})
in
    #"Multiplied Column"

 

or see attached PBIX.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
Anonymous
Not applicable

i shall and if it works i will post it here 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors