Knowledge Drop

Referencing the Quarter Timeframe in table calcs

Userlevel 5

Last tested: Jun 25, 2020

Say you're using a quarter timeframe that results in 2020-Q2, for example. If you were to create a table calculation referencing this, say

if(to_string(${quarter_field}) = "2020-Q2", ${arbitrary_field}, null)

You would never satisfy the Yes condition of the if() statement. This is due to the fact that quarter timeframes are being transformed via html from the format yyyy-mm to `yyyy-Qm`. We can confirm this is we open up the query in SQL Runner!


Since the quarter timeframes are actually appearing like "2020-01" for Q1, "2020-04" for Q2 and so on, you want to reference that date rather than the quarter format. Like so:

if(to_string(${quarter_field}) = "2020-04", ${arbitrary_field}, null)


Now you should see the Yes condition properly evaluated!


This content is subject to limited support.                



0 replies

Be the first to reply!