Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello, I'm trying to find an M formula that with increase the increment by 1 after every 3 rows. For example:
Row # Index
1 1
2 1
3 1
4 2
5 2
6 2
7 3
8 3
9 3
Thanks very much for any suggestions!
Solved! Go to Solution.
Hi @mstone3
You can achieve this by the GUI without any custom formula. Follow below steps!
First add an Index column starting from 1.
Then divide Index column by 3. From Transform tab > (Number Column) Standard > Divide.
Finally round up Index column. Transform > (Number Column) Rounding > Round Up.
Anyway, if you want a single M formula to get the same result, you can combine above three steps into one step. Paste below code into the formula bar and modify previous step name.
= Table.TransformColumns(Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type), {{"Index", each Number.RoundUp(_ / 3), type number}})
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
Hi @mstone3
You can achieve this by the GUI without any custom formula. Follow below steps!
First add an Index column starting from 1.
Then divide Index column by 3. From Transform tab > (Number Column) Standard > Divide.
Finally round up Index column. Transform > (Number Column) Rounding > Round Up.
Anyway, if you want a single M formula to get the same result, you can combine above three steps into one step. Paste below code into the formula bar and modify previous step name.
= Table.TransformColumns(Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type), {{"Index", each Number.RoundUp(_ / 3), type number}})
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
Thanks very much - this is a great solution!
This would work. If your prior step is named LastStep, add a new step. In the formula bar, type:
= Table.AddColumn(LastStep, "NewIndex", each if Number.Mod([Index], 3) = 0 then [Index]/3 else null)
Then you can use Fill Up function in the GUI for the missing values.
--Nate
Thank you very much!
Check out the July 2025 Power BI update to learn about new features.