Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

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.

1 ACCEPTED SOLUTION

@Anonymous

 

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

 


 


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


Proud to be a Datanaut!  

View solution in original post

4 REPLIES 4
LivioLanzo
Solution Sage
Solution Sage

@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] ) ),
        ", "
    )
)

 

Capture.PNG

 


 


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


Proud to be a Datanaut!  

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 yoursSee Concatenation is not working like yours

 

 

@Anonymous

 

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

 


 


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


Proud to be a Datanaut!  

Anonymous
Not applicable

Thanks For Your Help! Working with the Formula and dim table suggestion.

 


dim table.PNG

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.