First value and last value of the day

Hi, I’m looking for a solution where I can get the first value and also the last value of the day, and at the same time make the difference. of LastValue - FirstValue

TimeDefaultID (Date)
MaterialDefinition Name (material)
Totalizer (value)

That is, I need to get the first and last value of the totalizer of such material.

Hi @agustinmoncada94,

Can you try the following calculated fields?

Last Value = lastValue({Totalizer}, [{TimeDefaultID} ASC], [{MaterialDefinition Name}, truncDate('DD', {TimeDefaultID})])
First Value = firstValue({Totalizer}, [{TimeDefaultID} ASC], [{MaterialDefinition Name}, truncDate('DD', {TimeDefaultID})])
1 Like

Hello good morning, I am getting the following error when applying your calculated field…
“Table calculation attribute references are missing from field boxes”

1 Like

In turn, when I want to create a calculated field that I think may be the correct one, it generates this error

“The “Totalizador_Clinker_TnUNACEM Indicator” field must be added for table calculations.”

1 Like

Hi @agustinmoncada94,

When you use the lastValue and firstValue functions, all the fields present in your calculated field have to be in your visual. That’s what that error message is saying.

Can you add all your fields to your visual and hide the ones that you don’t want to show?

1 Like

Hi @agustinmoncada94,
It’s been awhile since we last heard from you, did you have any additional questions regarding your initial post?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Hi @agustinmoncada94

Since we have not heard back from you, I’ll go ahead and close/archive this topic. However, if you have any additional questions, feel free to create a new topic in the community and link this discussion for relevant information.

Thank you!

I m using similar function for my dashboard. and the data i m expecting only one record per month but receiving more than one record

please see my expression used in calculated field.

please find my group used for the table

But the table list one vin number record continuously multiple time