Forum Discussion
Anonymous
4 years agoNot applicable
Write value on every 5 rows
Dear Power Bi community, Do you know how I can write in PowerQuery: To index the rows based on their date ( earliest to latest) and to index them only if they have a special text value ( for e...
- 4 years ago
Yes, it's achievable. Sort the data on 2 columns (text, date).
Then do a 'Group By' on Text, using the All Rows aggregation.
Then add an index within each group with code similar to this:
Add a custom column
Table.AddIndexColumn([all], "sub", 1, 1, Int64.Type)[all] is the name of the All Rows column from the previous step.
Remove the columns that you don't want and expand the column headers to return the required data.
Good luck
KNP
4 years agoSuper User
Yes, with sort function, custom conditional index column and math.
Please provide some data.
- Anonymous4 years agoNot applicable
So everything is in the same table. I want the results to look like this.
The index based on the column 2 if I have "text" and in a chronological order by date. And every 5 indexes, to write in the new Column : Skip Lot
Column 1 Column 2 Date Index new Colum a b text 05/12/2021 2 c text 06/12/2021 3 d e text 07.12/2021 4 f g text 08/12/2021 5 SKIP LOT h text 01/12/2021 1