How to write calculated field formula in AWS QuickSight using ifelse

I am trying to write a formula that would calculate a discounted cost depending on the date.

Any costs that accrue after May 2019 would have a discount rate of 7% and anything prior to that would be 6%.

This is what I have for the formula but it's saying the syntax is incorrect. Any help would be much appreciated.

ifelse(month >= 5 AND year >= 2019), then {unblended_cost} - ({unblended_cost} * 0.07), else {unblended_cost} - ({unblended_cost} * 0.06))

1 Answer

Try the following and let me know if you encounter other errors

ifelse( month >= 5 AND year >= 2019, {unblended_cost} - ({unblended_cost} * 0.07), {unblended_cost} - ({unblended_cost} * 0.06)
) 

Essentially ifelse can be thought of as a single function, and the then and else keywords are extraneous.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like