Create a sum function from price to display the total

Greetings everyone,

Hope this finds well. I have not find a solution to this problem. I am trying to create a sum function to display the total of products purchased by every users but fo some reason I can find a way to do it.
I have understood that roll up might not work because we are working with decimal and not integer. However whenever I do a javascript code to implement it manually it does not work.

I have tried both of this code in order to convert the string list into numbers and finally sum it but the system does not seems to take it into account.
let numbersString = p1; //p1 is the “New Column A” containing the string
let numbersArray = numbersString.split(“;”).map(Number);

return numbersArray

I have tried with another extensive code but it is the same conclusion.
Anybody has a clue on this ?

Thank you

Have you tried a Rollup->Sum on your item-price column?

1 Like

I have the same issue. Roll up only gives me count functions…any suggestions

If you are only getting count functions, that means that your values aren’t being seen as numbers for some reason.

You mentioned something about rollup not working with decimals. That should not be the case. It shouldn’t matter if it’s a decimal or integer because they are still both numeric.

Can trace back to the origin of those numbers? At any point, do they get converted to strings? Maybe a template column somewhere along the line?

4 Likes

That is what I thought too but the column of origin is registered as numerical (column Price-EUR-nb in the image). It comes from another sheet, and I have created a relation to link it to the display sheet.
However, as you notice in the previous image item-price and New column which are respectively the look-up for column price EUR and price-EUR-nb convert those values into string. Is there any function to keep it into numbers, even an array of numbers will do.

Kind regards

This will only gives count of the array unfortunately.

Try this: edit the column Price-Eur-nb and then save it without doing anything. See if that changes anything.

I have done as instructed but the sum does not appear.

I have found a solution. It seems that I was going for something very complicated. What I have done is directly take the gift price from the interface and write it into a gift-price column in the claimed gift sheet. Then thanks to the rollup function I was able to compute the sum in the users sheet in order to display the total.

For other users that might be stuck :
I have identified the exact step that is problematic. In order to use the price information in the users table I create a ‘Joined List’ (New Column A in the Claimed Gifts table), when checking the type of the variable using a Javascript code I have a string. I was relying on lookup functions therefore I have not find a way to use the price information directly without converting it into a Joined List.

Takeaway:
Do the simple thing and find a way to directly intake the information somehow.

Thanks everyone for your reactivity, I really appreciate it. Being very new in the glide community I did not know what to expect regarding members’ response time but you were very reactive.

Have a good weekend.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.