Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DAX How To Dynamically Concatenate Earlier Row Values

I would like to, using DAX because my table will be filtered dynamically and have different ModelNumbers each time, come up with a way to produce a concatenated list (comma deliminated) of all Val1 row values in scope.

 

ModelNumberVal1DYNAMIC COLUMN
100-01456456
200-0121456, 21
300-0218456, 21, 18
400-015456, 21, 18, 5

 

 

CURRENT FORMULA:

            PreviousText = MINX(
                              FILTER('Table1',
                                       'Table1'[modelNumber] = EARLIER('Table1'[modelNumber])),
               'Table1'[Val1])

Current Result: Error Message: single value for modelNumber cannot be determined.

  • Anonymous

     

    I just normalized the ModelNumber into a dimension table that is why you see it as another table

4 Replies

  • Anonymous

     

    Not sure if you are after something like this?

     

     

    =
    IF (
        HASONEVALUE ( 'Models'[ModelNumber] ),
        CONCATENATEX (
            FILTER (
                ALLSELECTED ( 'Models'[ModelNumber] ),
                'Models'[ModelNumber] <= SELECTEDVALUE ( 'Models'[ModelNumber] )
            ),
            CALCULATE ( SUM ( Data[Val1] ) ),
            ", "
        )
    )

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for the fast response. Your example is exactly what I am looking to do. My results outputs are not the same as yours. The only difference I see is all my data is coming from the same table, and you have the values coming from the data table as an example. What am I doing wrong?

       

      See Concatenation is not working like yours

       

       

      • LivioLanzo's avatar
        LivioLanzo
        Solution Sage

        Anonymous

         

        I just normalized the ModelNumber into a dimension table that is why you see it as another table