Rick Freitas
Rick Freitas

Reputation: 1

PowerQuery Create grouped Index or Column

Example Table

In Powerquery I have a table that has column Text After Delim that has numbers repeating (see attached Example Table).

I would like to create a column that groups 3 numbers with a combined index #. For example,

1,2,3 = 1;
4,5,6 = 2;
7,8,9 = 3;

and so on.

Suspecting I can do this with a formula in a custom column, but not sure how that is done. Thanks for your help with this!

Upvotes: 0

Views: 152

Answers (1)

Marco Vos
Marco Vos

Reputation: 2967

Try inserting this M code in your PowerQuery script (Advanced Editor)

#"Add new Column"= Table.AddColumn(#"Insert name previous step",
  "Desired Output", each Number.RoundUp([AantalEvents]/3,0))

For a calculated column in DAX that would be:

Desired Output = ROUNDUP([Text After Delim]/3,0)

Upvotes: 1

Related Questions