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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Combine Columns with 1 value in each to one column with entire list

EDIT: I totally forgot that all other cells say "null" and the original answer isn't working with that tossed in. Any way to disregard the nulls?

 

Hello,

How would I combine columns that have one value per row? For example:

 

Column 1Column 2Column 3Column 4Column 5
Bluenullnullnullnull
nullGreennullnullnull
nullnullnullYellownull
nullnullnullnullOrange
nullnullPinknullnull

 

Only one of these columns can contain data for each row. How do I collapse this to:

Column
Blue
Green
Yellow
Orange
Pink
3 ACCEPTED SOLUTIONS
jdbuchanan71
Super User
Super User

In the query editor you can add a custom column that combines your existing into 1.

jdbuchanan71_0-1617042076516.png

 

View solution in original post

jdbuchanan71
Super User
Super User

If you select all your columns you can right click on them an go to replace and replace null with (leave this box empty)

jdbuchanan71_0-1617048463155.png

 

View solution in original post

Hi  @Anonymous ,

 

You could also create a calculated table using below dax expression:

 

Table 2 =
UNION (
    CALCULATETABLE (
        VALUES ( 'Table'[Column 1] ),
        FILTER ( 'Table', 'Table'[Column 1] <> "null" )
    ),
    CALCULATETABLE (
        VALUES ( 'Table'[Column 2] ),
        FILTER ( 'Table', 'Table'[Column 2] <> "null" )
    ),
    CALCULATETABLE (
        VALUES ( 'Table'[Column 3] ),
        FILTER ( 'Table', 'Table'[Column 3] <> "null" )
    ),
    CALCULATETABLE (
        VALUES ( 'Table'[Column 4] ),
        FILTER ( 'Table', 'Table'[Column 4] <> "null" )
    ),
    CALCULATETABLE (
        VALUES ( 'Table'[Column 5] ),
        FILTER ( 'Table', 'Table'[Column 5] <> "null" )
    )
)

 

And you will see:

v-kelly-msft_0-1617261626497.png

 For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

5 REPLIES 5
jdbuchanan71
Super User
Super User

If you select all your columns you can right click on them an go to replace and replace null with (leave this box empty)

jdbuchanan71_0-1617048463155.png

 

jdbuchanan71
Super User
Super User

In the query editor you can add a custom column that combines your existing into 1.

jdbuchanan71_0-1617042076516.png

 

Anonymous
Not applicable

Okay, one more wrinkle.....all the other fields have "null" in them so my result is all "null". How can I work around that?

Hi  @Anonymous ,

 

You could also create a calculated table using below dax expression:

 

Table 2 =
UNION (
    CALCULATETABLE (
        VALUES ( 'Table'[Column 1] ),
        FILTER ( 'Table', 'Table'[Column 1] <> "null" )
    ),
    CALCULATETABLE (
        VALUES ( 'Table'[Column 2] ),
        FILTER ( 'Table', 'Table'[Column 2] <> "null" )
    ),
    CALCULATETABLE (
        VALUES ( 'Table'[Column 3] ),
        FILTER ( 'Table', 'Table'[Column 3] <> "null" )
    ),
    CALCULATETABLE (
        VALUES ( 'Table'[Column 4] ),
        FILTER ( 'Table', 'Table'[Column 4] <> "null" )
    ),
    CALCULATETABLE (
        VALUES ( 'Table'[Column 5] ),
        FILTER ( 'Table', 'Table'[Column 5] <> "null" )
    )
)

 

And you will see:

v-kelly-msft_0-1617261626497.png

 For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

Anonymous
Not applicable

So simple Thank you! I'm still very new and appreciate the help!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors