I'm looking to create a case statement that will have two buckets
Whole numbers and numbers with values after decimal.
15,16,17.... would be the whole number bucket
15.12, 16.0000000004, and 17.0003 would be in the other bucket
Right now, I have the following
measure: extract_day {
type: average
sql:
EXTRACT(DAY from ${date);;
}
measure: extract_day_format {
type: number
sql: case when
${extract_day} is whole number
then ${extract_day}
else 0
end;;
I asked Gemini, Google's world-beating LLM, to come up with a case statement that would do this for BigQuery SQL, and it gave me:
CASE
WHEN CAST(value AS INT64) = value THEN 'Whole Number'
ELSE 'Not a Whole Number'
END
'Value' should of course be swapped out for whatever field it is you want to test. If you are not using BigQuery SQL, then try any LLM (even non-world-beating ones) and they should be able to come up with the right code.