# SIN and COS availability in Quicksight to calculate distance

**URL:** <https://community.amazonquick.com/t/sin-and-cos-availability-in-quicksight-to-calculate-distance/11621>\
**Category:** Q&A\
**Tags:** feature-request, calculations, quick-sight\
**Created:** [March 29, 2023, 6:39pm UTC](https://community.amazonquick.com/t/sin-and-cos-availability-in-quicksight-to-calculate-distance/11621 "2023-03-29T18:39:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amanda\_N\_Avent](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@Amanda\_N\_Avent](https://community.amazonquick.com/u/Amanda_N_Avent)\
**Post date:** [March 29, 2023, 6:39pm UTC](https://community.amazonquick.com/t/sin-and-cos-availability-in-quicksight-to-calculate-distance/11621/1 "2023-03-29T18:39:20Z")

</div>

> [@Is Mathematical function like sin,cos,tan value available in quicksight?](https://community.amazonquick.com/t/is-mathematical-function-like-sin-cos-tan-value-available-in-quicksight/10824):
>
> Hi All, Is mathematical functions like sin, cos, tan value available in quicksight?

This was asked previously and then archived. This is also a crucial function I need in Quicksight. We are being forced to transition from PowerBI to Quicksight. We have a dashboard that calculates the distance between lat and long for two locations based on a table of all locations and a location selected (filter) by the end user. The “best” way to do this is through the haversine formula. This does not appear to be possible at all in Quicksight currently as SIN and COS are not available calculation options. This is the DAX code used in PowerBI to get the distance in miles. If there is another option to utilize in Quicksight, I’m open to it, but I do not believe there is.

Parameter Distance (mi) =

VAR \_\_latSelected = SELECTEDVALUE(‘FC\_Data’[latitude])  
VAR \_\_lonSelected = SELECTEDVALUE(‘FC\_Data’[longitude])  
VAR \_\_radius = 3956  
VAR \_\_multiplier = PI()/180  
VAR \_\_latDiff = ([Parameter Selector Latitude Value]-\_\_latSelected) \* \_\_multiplier  
VAR \_\_lonDiff = ([Parameter Selector Longitude Value]-\_\_lonSelected) \* \_\_multiplier  
VAR \_\_formula1 =  
SIN(\_\_latDiff/2) \* SIN(\_\_latDiff/2) +  
COS([Parameter Selector Latitude Value] \* \_\_multiplier) \* COS(\_\_latSelected \* \_\_multiplier) \*  
SIN(\_\_lonDiff/2) \* SIN(\_\_lonDiff/2)  
VAR \_\_formula2 = 2 \* ATAN(DIVIDE(SQRT(\_\_formula1),SQRT(1-\_\_formula1)))  
VAR \_\_distance = \_\_radius \* \_\_formula2  
RETURN \_\_distance

---

<div class="post-metadata">

**Author:** ![Thomas](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/thomas/32/3624_2.png) [@Thomas](https://community.amazonquick.com/u/Thomas)\
**Post date:** [March 30, 2023, 7:31am UTC](https://community.amazonquick.com/t/sin-and-cos-availability-in-quicksight-to-calculate-distance/11621/2 "2023-03-30T07:31:14Z")

</div>

Hi @Amanda_N_Avent,

Welcome to the community! As of now, trigonometric functions like SIN, COS, TAN are not natively supported within Quick Sight. Depending on the data source that you are using, you might be able to do the calculation within the data source using direct query mode for the respective dataset.

At AWS, our roadmap is primarily driven by our customers. Your feedback helps us build a better service. I have noted this in our internal feature request tracker.

Once taken note of it, we archive the questions within the community (this is also what you’ve observed on the previous question). To stay up-to-date with the latest Quick Sight updates, please have a look at and subscribe (“watch”) to the [What’s New/Blog category](https://community.amazonquick.com/c/announcements/).

---

<div class="post-metadata">

**Author:** ![Amanda\_N\_Avent](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@Amanda\_N\_Avent](https://community.amazonquick.com/u/Amanda_N_Avent)\
**Post date:** [March 30, 2023, 4:07pm UTC](https://community.amazonquick.com/t/sin-and-cos-availability-in-quicksight-to-calculate-distance/11621/3 "2023-03-30T16:07:36Z")

</div>

Yes, I found a solve within SQL. Thanks.

---

<div class="post-metadata">

**Author:** ![Thomas](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/thomas/32/3624_2.png) [@Thomas](https://community.amazonquick.com/u/Thomas)\
**Post date:** [March 30, 2023, 4:29pm UTC](https://community.amazonquick.com/t/sin-and-cos-availability-in-quicksight-to-calculate-distance/11621/4 "2023-03-30T16:29:58Z")

</div>


