SIN and COS availability in Quicksight to calculate distance

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

Hi @Amanda_N_Avent,

Welcome to the community! As of now, trigonometric functions like SIN, COS, TAN are not natively supported within QuickSight. 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 QuickSight updates, please have a look at and subscribe (“watch”) to the What’s New/Blog category .

Yes, I found a solve within SQL. Thanks.