Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregation Function for summing hours #1344

Open
ghmc91 opened this issue Sep 28, 2023 · 0 comments
Open

Aggregation Function for summing hours #1344

ghmc91 opened this issue Sep 28, 2023 · 0 comments

Comments

@ghmc91
Copy link

ghmc91 commented Sep 28, 2023

I have an object with one of its attributes (disponibilidade) having its values in hours, in the format hh:mm (07:30). So that I can do the sum, I do manipulations to put the data in decimal format hh.mm (7.30). However, when I can the sum aggregation function, it calculates the values as decimal - as expected - and in the last line it is possible to find values after the decimal point equal to or above 60 (which would indicate an extra hour). Does anyone know how I can do the sum the hours correctly?

My Code:

$(function(){ var tpl = $.pivotUtilities.aggregatorTemplates; $('#tb-disponibilidade').pivotUI( result, { rows: ["operador"], cols: ["dias_uteis"], aggregators: { "SomaHoras": function(){ var resultFinal = tpl.sum()(["disponibilidade"]) return resultFinal; } }, aggregatorName: "SomaHoras", vals: ["disponibilidade"] } ) })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant