Forum Discussion

devitus's avatar
devitus
Frequent Visitor
4 years ago
Solved

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 t...
  • PaulOlding's avatar
    4 years ago

    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]
    )