Date calculation

H team,
i hope you can help me:
How can I translate this sql-where-calculation in a QuickSight calculation:
…where ctr2.AccommodationID = acc.AccommodationID
vrs2.travelstartdate between vrs.travelstartdate and vrs.travelenddate) = 1 then ‘Please Check!’ else ‘’

Hi @JuliaFee

Thank you for posting your question.

Could you please try this and let me know if it works.

ifelse(
{ctr2.AccommodationID} = {acc.AccommodationID}
&& {vrs2.travelstartdate} >= {vrs.travelstartdate}
&& {vrs2.travelstartdate} <= {vrs.travelenddate},
‘Please Check!’,
‘’
)

Note -

  • ‘Please Check!’: Returned when the condition is true.
  • ’ ’ (empty string): Returned when the condition is false.
    [Update from QuickSight team: Replace the && in Shravya’s response with and (spelled out operator name) and it should work. ]
    Thank you,
    Shravya
1 Like

Hi Julia, Shravya, @JuliaFee , @shravya ,

I assume the ask here is how to translate an SQL case statement.
Replace the && in Shravya’s response with and (spelled out operator name) and it should work.
Adding this note above and marking it as solution.

Regards,
Arun Santhosh
Pr QuickSight SA

2 Likes