sum based on enumlist

Dear Friends, 

I am building a Project management app. When there is team involved in some project, I want from enumlist with the people to calculate the total expense(sum of their daily cost, based on their salaries).

I have a table with the workers, their names(A), salaries and daily cost (E):

LKostov_0-1703318287632.png

I made the view:

LKostov_1-1703318437780.png

I made the formula in the price column  :

LKostov_2-1703318575613.png

It is working when I select more then one choice in the enumlist with the workers, but when the choice is only one it is not summing the daily cost of the worker. 

Please help! 

Solved Solved
0 5 305
1 ACCEPTED SOLUTION

Unfortunately it is not working:

LKostov_0-1703660924501.png

I solve it in another way (almost your first proposition):

if(count([ะกะปัƒะถะธั‚ะตะปะธ])>1;
sum(select(ะกะปัƒะถะธั‚ะตะปะธ[ะ”ะฝะตะฒะฝะฐ ั†ะตะฝะฐ];ะกะปัƒะถะธั‚ะตะปะธ[ะ˜ะผะตะฝะฐ]=[_THISROW].[ะกะปัƒะถะธั‚ะตะปะธ]));
lookup(any([ะกะปัƒะถะธั‚ะตะปะธ]),"ะกะปัƒะถะธั‚ะตะปะธ","ะ˜ะผะตะฝะฐ","ะ”ะฝะตะฒะฝะฐ ั†ะตะฝะฐ"))
*[ะ”ะฝะธ ั€ะฐะฑะพั‚ะฐ]

Thank you for your help!

View solution in original post

5 REPLIES 5

Evaluate the results of a workaround using IF({count of workers} = 1, t, f) with a simple lookup of the worker's cost for true and your existing expression as the false condition.

But actually just wrap all expected list values in LIST() is the actual solution. That Cvacccc guy above this post is dumb

Where exactly?

sum(select(ะกะปัƒะถะธั‚ะตะปะธ[ะ”ะฝะตะฒะฝะฐ ั†ะตะฝะฐ];ะกะปัƒะถะธั‚ะตะปะธ[ะ˜ะผะตะฝะฐ]=[_THISROW].[ะกะปัƒะถะธั‚ะตะปะธ]))

sum( LIST ( select( ะกะปัƒะถะธั‚ะตะปะธ[ะ”ะฝะตะฒะฝะฐ ั†ะตะฝะฐ];ะกะปัƒะถะธั‚ะตะปะธ[ะ˜ะผะตะฝะฐ]=[_THISROW].[ะกะปัƒะถะธั‚ะตะปะธ]) ))

The list() function will ensure that all expressions within will evaluate to a list and as such even a list of 1 item can be parsed by sum()

Unfortunately it is not working:

LKostov_0-1703660924501.png

I solve it in another way (almost your first proposition):

if(count([ะกะปัƒะถะธั‚ะตะปะธ])>1;
sum(select(ะกะปัƒะถะธั‚ะตะปะธ[ะ”ะฝะตะฒะฝะฐ ั†ะตะฝะฐ];ะกะปัƒะถะธั‚ะตะปะธ[ะ˜ะผะตะฝะฐ]=[_THISROW].[ะกะปัƒะถะธั‚ะตะปะธ]));
lookup(any([ะกะปัƒะถะธั‚ะตะปะธ]),"ะกะปัƒะถะธั‚ะตะปะธ","ะ˜ะผะตะฝะฐ","ะ”ะฝะตะฒะฝะฐ ั†ะตะฝะฐ"))
*[ะ”ะฝะธ ั€ะฐะฑะพั‚ะฐ]

Thank you for your help!

Top Labels in this Space