Latest Value from 1st day of month

Hi Team.

I have requirement where need to fetch data by metric for monthly basis.
And i have data for every day of month.
Now to design a metric in which it will fetch data for 1st day of every month in given interval.
Like if my metric as follows
{
“id”: “EmployeeInOutCntDay”,
“name”: “EmployeeInOutCntDay”,
“path”: “employee”,
“srcType”: “Company”,
“expression”: “sum(sum(normalized.data.employeeInOutCnt01Day))”,
}

And my eval metric as follows
c3Viz(Company.evalMetrics({ids: [“1234”],expressions: [“EmployeeInOutCntDay”], start: “2019-02-01T00:00:00.000”,end: “2019-04-20T00:00:00.000”, interval: “MONTH” }))

It gives me same value for all months.

Please help me to define expression so values return will be 1st day of month from type Employee and field name as employeeInOutCnt01Day

Thanks
Prashant Mahale

As output, you desire to have a single value for each month, where that value equals the number of times that an employee entered a building on the 1st day of that month?

So my data is like as follows

|1-Apr|59|
|15-Apr|79|
|30-Apr|86|
|1-May|90|
|15-May|79|
|30-May|71|

now i need value of 1st day of every month
Also need now i need value of last day of every month

i hope you got issue

A separate metrics for 1st and last day values will also work but need expression to get values

Given your input example, if you need monthly output “1-Apr: 86, 1-May: 71”, change the time-aggregation treatment to ‘previous’

“expression”: “sum(previous(normalized.data.employeeInOutCnt01Day))”

Refer to c3ShowType(Treatment)

Thanks for the reply and how to get |1-Apr|59| |1-May|90| values
tried with “expression”: “sum(earliest(normalized.data.employeeInOutCnt01Day))” but it shows dateversion not value and when used earliestValue for whole interval it shows same value
Thanks