Showing results for 
Search instead for 
Did you mean: 

While Loop

Super User
Super User
Super User

While Loop

A way to emulate a traditional "while" loop using DAX. For a detailed explanation, see this article:


For a practical implementation, see my "Days of Supply" Quick Measure:



While Loop = 
// Provide some starting value via user input
VAR __i = 10
// Generate a "loop table", this will emulate a while loop
VAR __loopTable = GENERATESERIES(1,__i)
// Add in our calculated value, emulating calculations done as iterations over the loop
VAR __loopTable1 = ADDCOLUMNS(__loopTable,"__i",[Value] - 1)



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!