Unlike the vast majority of coding language, DAX has no code constructs to perform true looping. This can be somewhat challenging, and perhaps a bit disconcerting, for individuals new to DAX who come from a coding background in a more traditional programming language. Most developers have come to rely heavily upon control flow statements such as the for and while loops. The for and while loops have a similar structure. Each has a header portion that specifies the boundary conditions or limits for iteration. Each also has a body, which is a group of coding statements that are executed once per iteration.
This recipe provides methods for emulating for and while loops in DAX using table constructs.