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.
I am trying to make a for loop in power query but I am unable to.
I need to create a new column that accumulates +1 if for the same employee and successive dates and situation="abs" increments its value by 1 otherwise it would have to restart at 0.
I have tried List.Generate, but I don't know how to implement it in a column.
it's hard to do this with Table.AddColumn, suggest you to add a new step with this code
NewStep=Table.FromRecords(List.Accumulate(Table.ToRecords(PreviousStepName),{{},"",0,0},(x,y)=>if y[Empoyee]=x{1} and y[Situation]="ABS" and y[Date]=Date.AddDates(x{2},1) then {x{0}&{y&[LD=x{3}+1]},y[Employee],y[Date],x{3}+1} else {x{0}&{y&[LD=Byte.From(y[Situation]="ABS")]},y[Employee],y[Date],Byte.From(y[Situation]="ABS")}){0})
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.