I am working on a chart bar that the x-axis is a date aggregated by month. ¿Is is posible to aggregate by day but only show the last day of each month using a filter o by other way? Other possibility i see is to create a calculated field to show the value for the last day of the aggregated period but i have not been able to do it ¿Is it posible?
i finally solve it like this using the posted formulas:
parseDate
(
concat
(
toString(extract("YYYY",addDateTime(1,"DD",addDateTime(1,"MM",truncDate("MM",date)))))
,"-"
,toString(extract("MM",addDateTime(1,"DD",addDateTime(1,"MM",truncDate("MM",date)))))
,"-"
,toString(extract("DD",addDateTime(-1,"DD",addDateTime(1,"MM",truncDate("MM",date)))))
)
,'yyyy-MM-dd')
And because current month have not ended so i don't have data for the the last day i use an ifelse like this:
ifelse(
parseDate(
concat(
toString(extract("YYYY",addDateTime(-1,"DD",addDateTime(1,"MM",truncDate("MM",date)))))
,"-"
,toString(extract("MM",addDateTime(-1,"DD",addDateTime(1,"MM",truncDate("MM",date)))))
,"-"
,toString(extract("DD",addDateTime(-1,"DD",addDateTime(1,"MM",truncDate("MM",date))))))
,'yyyy-MM-dd')
>= now()
,addDateTime(-1,"DD",now())
,parseDate(concat(toString(extract("YYYY",addDateTime(-1,"DD",addDateTime(1,"MM",truncDate("MM",date)))))
,"-"
,toString(extract("MM",addDateTime(-1,"DD",addDateTime(1,"MM",truncDate("MM",date)))))
,"-"
,toString(extract("DD",addDateTime(-1,"DD",addDateTime(1,"MM",truncDate("MM",date)))))
)
,'yyyy-MM-dd')
)
And finally i created de following calculated field:
sumIf(base,formatDate(date,'yyyy-MM-dd') = formatDate({fecha_last_day},'yyyy-MM-dd'))
The result:
The value related to the last day for each month, and for current month the last day with able data