Forum Discussion
jdugas
9 years agoAdvocate I
Sum based on Different Column
Is it possible to create a calculated column to sum all column names that begin with "ANSWERx" where "x" is either a single digit or double digit? I'm trying to find a score for survey results.
- 9 years ago
Hello,
People here have given great ideas. This question is complicated. Maybe there is no easy answer. You can try this.
- Add an index to the table in Query Editor.
- Choose three columns with CTRL. Then click Unpivot Columns.
- Create a measure.
Average =
SUM ( Table1[Value] ) / COUNT ( Table1[Value] )
MarcelBeug
9 years agoCommunity Champion
A Power Query (query editor) solution would be to add a column with the following code:
= List.Sum(List.Transform(List.Zip({Record.FieldNames(_),Record.FieldValues(_)}), each if Text.Start(Text.Upper(_{0}),6) = "ANSWER" then _{1} else 0))jdugas
9 years agoAdvocate I
Not following you. I agree something more powerful then writing out each column name, having the ability to reference column names using wildcards, survey results, would prove benefitial.
What do others do/think?
Jeremy
- MarcelBeug9 years agoCommunity Champion
jdugas who is "you" you are not following?