Compare use a date literal in a Calculated Field on a Pivot

Answered
Mario Rodrigues asked on August 15, 2024

Hello,

I have Pivot table and created a Calculated Field using this formula: if( max("r.date_of_service")="8/9/2024",1000,0). However I get this warning each time:
"Wrong formula format. Please check formula details. The field with the "8/9/2024" uniqueName is not defined."  Can you please advise what the correct formula should be? I tried the following formula which does not throw a warning, but does not work in the Pivot: 
if( max("r.date_of_service") = 8/9/2024,1000,0). So, how do I specify a literal Date value in the formula expression???

Thanks.

1 answer

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster August 19, 2024

Hello Mario,

Thank you for reaching out to us.

Currently, it is possible to use dates in the Calculated values in the Unix timestamp format in milliseconds. For example:

formula: "if(max('Date') = 1723150800000, 1000, 0"

Please check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/3gunaxy4/.

Kindly note that this approach mainly works for ready-to-use reports, where you can predefine the necessary calculated values with dates using timestamps in the code.

We hope it helps. You are welcome to contact us if other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer