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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Distance between locations - calculated column error

Hi,
I used this below formula in a test report to calculate distance between a series of locations based on their contractual and actual location lats/longs in table 'Totalmonthdrop'. Now that I have come to use this formula in the real report, I am getting the error "An argument of function ACOS has the wrong data type or the result is too large or too small"

 

All lats/longs that I have are listed as decimal numbers.

 

Anyone have any thought as to how to solve this issue?

distance_issue.JPG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

you can wrap the function in IFERROR(...,Blank()) and see if that helps

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

you can wrap the function in IFERROR(...,Blank()) and see if that helps

Anonymous
Not applicable

Hi Nick - that seems to have addressed the issue - weirdly

 

When using the iferror, it only highlighted 1 row of the thousands I have as an error, which then allowed all rows to have correct info load in.

 

Any thoughts on why 1 row would cause all rows of this calculated column to fail, and why the below lats/ long would error in the first place, as have checked and numbers are correct?

 

Captussre.JPG

Many thanks for your solution anyway - have marked it accordingly.

 

Anonymous
Not applicable

"Any thoughts on why 1 row would cause all rows of this calculated column to fail, and why the below lats/ long would error in the first place, as have checked and numbers are correct?"

 

 

DAX operates on an all or nothing basis since everything happens in columns vs. individual cells like excel. Which is why in excel you can get an error for a specific cell but the rest of the formulas are fine. Just a different way of thinking of things, and the thinking in columns and filters is the biggest hurdle from someone coming from excel ( at least that was and really still is my experience). 

 

I honestly dont know enough about the functions you are using. but looking at the Dax help, there is something in your data where it violates the definition of must be between -1 and 1:

ACOS.png

 

I run into the same type of thing in my day-to-day job since I use the POWER function, and if there is something wierd in the data it will error, Ideally, would fix the data in the ETL stage or catch it w/o using an IFERROR since IFERROR can be a performance hit, but when you start going a few levels deep in calculations I find it easier to just use the IFERROR. 

 

Anonymous
Not applicable

@Anonymous  Thanks Nick - you have been a great help. 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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