Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Your file has been submitted successfully. We’re processing it now - please check back in a few minutes to view your report.
A way to emulate a traditional "while" loop using DAX. For a detailed explanation, see this article:
https://community.powerbi.com/t5/Community-Blog/For-and-While-Loops-in-DAX/bc-p/637511
For a practical implementation, see my "Days of Supply" Quick Measure:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Days-of-Supply/m-p/635656
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) RETURN COUNTROWS(FILTER(__loopTable1,[__i]>1))+1
eyJrIjoiOThmZTRjZmQtNjAwMS00NDc4LTg0ZWYtNWZjMWM1YWQ0NGEwIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9