Expression required -Enum list having different weightage to different options

Hi 

@1minManager @Steve Need one more help . How can i build an expression for enum list type with every options having different weightage .? You have given the perfect solution for enum type with different weightage(3,2,1 for different answers) and enum list type with same weightage (1 point for each option). But please help me creating an expression for the below data . Enum list in which user can select multiple options and all the weightage gets added in case of more then one selection.

I can make an expression like this but it will be really complex if options are more . there will be so many possible combinations . Is there any better way to handle this ?


IFS(
[column]=LIST("option A"),3,
[column]=LIST("option B."),1,
[column]=LIST("option A","option B"),4,
TRUE,0
)

rahuldash171_0-1657722103255.png

 

 

Solved Solved
0 7 175
2 ACCEPTED SOLUTIONS

Steve
Platinum 4
Platinum 4
(
  0
  + IFS(IN("Option A", [EnumList]), 3)
  + IFS(IN("Option B", [EnumList]), 1)
  ...
)

View solution in original post

I think @Steve 's solution takes care of all combinations. The IFS() will add each time that element is present in the selection. So the below statement need not be written for all 5 combinations or any other such combinations.

IFS(IN("Option A","Option B","Option C","Option D","Option E", [EnumList]), 8)

 Instead the following part will look for presence/absence of each element in the selection and will add if the element is present in the selection. So if 5 are present , it will add weights of all 5, 4 are present it will add weights of those 4 and so on.

(
0
+ IFS(IN("Option A", [EnumList]), 3)
+ IFS(IN("Option B", [EnumList]), 1)
+ IFS(IN("Option C", [EnumList]), 2)
+ IFS(IN("Option D", [EnumList]), 1)
+ IFS(IN("Option E", [EnumList]), 1)
)

 

 

 

View solution in original post

7 REPLIES 7

Steve
Platinum 4
Platinum 4
(
  0
  + IFS(IN("Option A", [EnumList]), 3)
  + IFS(IN("Option B", [EnumList]), 1)
  ...
)

Thanks a lot @Steve , but for single select it will work and the expression is simple . But for e.g 5 options are there and user can select as per his/her wish any possible combination , In this case do i have to create a expression for all kind . Please see the expression below .

(
  0
  + IFS(IN("Option A", [EnumList]), 3)
  + IFS(IN("Option B", [EnumList]), 1)
  + IFS(IN("Option C", [EnumList]), 2)
  + IFS(IN("Option D", [EnumList]), 1)
  + IFS(IN("Option E", [EnumList]), 1)
  + IFS(IN("Option A","Option B","Option C","Option D","Option E", [EnumList]), 8)
  + IFS(IN("Option A","Option B","Option C","Option D", [EnumList]), 7)
  + IFS(IN("Option A","Option B","Option C", [EnumList]), 6)
  .........
)

 There are multiple options and the more the number of options the complexity if the expression will increase as i have to think all the possible set of user inputs . 

I think @Steve 's solution takes care of all combinations. The IFS() will add each time that element is present in the selection. So the below statement need not be written for all 5 combinations or any other such combinations.

IFS(IN("Option A","Option B","Option C","Option D","Option E", [EnumList]), 8)

 Instead the following part will look for presence/absence of each element in the selection and will add if the element is present in the selection. So if 5 are present , it will add weights of all 5, 4 are present it will add weights of those 4 and so on.

(
0
+ IFS(IN("Option A", [EnumList]), 3)
+ IFS(IN("Option B", [EnumList]), 1)
+ IFS(IN("Option C", [EnumList]), 2)
+ IFS(IN("Option D", [EnumList]), 1)
+ IFS(IN("Option E", [EnumList]), 1)
)

 

 

 

Thanks a lot for the clarification . Let me try it at my end . Thanks a ton !!

You are welcome. You can almost always blindly implement @Steve  's suggestions. 👍

I joined post thread because I notice your most posts are in this time frame whereas typically @Steve will be active after another 6/7 hours based on his location time zone. So just thought, a small explanation could save you some time. 🙂

Its working !! Great help . Thanks again.

Thank you for the update. Good to know it works per your need. Please note, it is truly @Steve 's solution. 

Top Labels in this Space