Forum Discussion

smpa01's avatar
smpa01
Community Champion
2 years ago
Solved

DAX forLoop

AlexisOlson  is it possible to replicate a forLoop in DAX. I need a forLoop that works in filter context. I am not able to find anything that can do the following in DAX.   let src=Table...
  • lbendlin's avatar
    lbendlin
    2 years ago
    Custom DAX =
    VAR i = [index]
    VAR b =
        ADDCOLUMNS (
            FILTER ( Query1, [index] >= i ),
            "g",
                VAR i2 = [index]
                RETURN
                    SUMX ( FILTER ( Query1, [index] >= i && [index] <= i2 ), [Value] )
        )
    RETURN
        CONCATENATEX ( FILTER ( b, [g] <= 100 ), [row], "-" )