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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
devitus
Frequent Visitor

Repeating "Key" column value in Calculated Table when merging two columns from Source Table into one

Hi,

 

I am trying to create a new calculated table based on another table:

 

"ASINs" and "SKUs" columns from source table would be combined into a single "ASINs & SKUs" column of the calculated table (distinct values and excluding blanks from both "ASINs" and "SKUs" source columns), while repeating the respective "Key" column. Other columns (Data 1, 2, 3..) would be ignored.

 

Screenshot 2021-12-01 110151.png

 

I have tried the following, but the expression didn't work claiming "A table of multiple values was supplied where a single value was expected."

Calculated Table = SELECTCOLUMNS(Source Table, "Key", Source Table[Key], "ASINs & SKUs", UNION(VALUES(Source Table[ASIN]), VALUES(Source Table[SKU])))

 

Thanks in advance for your help!

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Hi @devitus 

The UNION function needs you to supply the whole table, not just a particular column

Try this:

VAR _Unioned = 
UNION(
    SELECTCOLUMNS(
        FILTER('Table', NOT ISBLANK('Table'[ASINs])), 
        "Key", 'Table'[Key], "ASINS & SKUs", 'Table'[ASINs]
        ),
    SELECTCOLUMNS(
        FILTER('Table', NOT ISBLANK('Table'[SKUs])), 
        "Key", 'Table'[Key], "ASINS & SKUs", 'Table'[SKUs])
)
VAR _Distinct = 
SUMMARIZE(
    _Unioned,
    [Key], [ASINS & SKUs]
)

View solution in original post

2 REPLIES 2
PaulOlding
Solution Sage
Solution Sage

Hi @devitus 

The UNION function needs you to supply the whole table, not just a particular column

Try this:

VAR _Unioned = 
UNION(
    SELECTCOLUMNS(
        FILTER('Table', NOT ISBLANK('Table'[ASINs])), 
        "Key", 'Table'[Key], "ASINS & SKUs", 'Table'[ASINs]
        ),
    SELECTCOLUMNS(
        FILTER('Table', NOT ISBLANK('Table'[SKUs])), 
        "Key", 'Table'[Key], "ASINS & SKUs", 'Table'[SKUs])
)
VAR _Distinct = 
SUMMARIZE(
    _Unioned,
    [Key], [ASINS & SKUs]
)

Absolutely amazing, thanks so much @PaulOlding! Worked perfectly 🙂

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.