Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Question on computed column / aggregation / sum #2963

Unanswered
davisford asked this question in Q&A
Discussion options

I am attempting to display a labor report which displays employee shift hours. Each row has a column for employee that has the total number of shift seconds worked.

Viewers of this report would prefer to see the data in a more friendly, readable way like 5h 30m worked for a shift as opposed to 19,800 seconds or 5.5 hours.

The labor report has a few grouped columns and the shift time is summed correctly when dealing with a purely numeric type as shown here.

Screenshot 2025年03月27日 at 9 55 58 AM

The Shift Hours is a computed column with the formula ("Shift Seconds" / 3600) which works fine as sum and adds up just fine.

Screenshot 2025年03月27日 at 10 32 53 AM

The problem I am having is when I try to put in a formula to add a new computed column that converts it to the more human readable format (which ends up converting it to a string). Once converted to a string it can no longer be used as a sum.

Here when I attempt to create a computed column that represents the number of hours worked as, e.g. 6h as it is converted to a string representation, it can no longer be used as a sum, and grouped rows will no longer sum. It has to be specified as unique

Screenshot 2025年03月27日 at 10 44 02 AM

I was hoping to work around this by making a hidden computed columns that just had the truncated integer representation for hours and minutes, and then use another computed column that uses those int sum columns to display them as a string, but it seems that a computed column cannot be referenced in ExprTk by another computed column.

Is there a possible workaround to achieve my ultimate goal which is to be able to represent the integer sum Shift Seconds in human readable string format 6h 30m but maintain the column sum for grouped row summaries?

You must be logged in to vote

Replies: 1 comment

Comment options

This is a formatting problem, other grids like agGrid solve this by using valueFormatters.

I think perspective can adopt the same idea by supporting expressions over base columns purely for formatting without affecting the original value of the base column.

This would allow for fully custom formatting while keeping the UX simple.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /