Forum Discussion
devitus
4 years agoFrequent 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 t...
- 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] )
PaulOlding
Solution Sage
4 years agoHi 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]
)devitus
4 years agoFrequent Visitor
Absolutely amazing, thanks so much PaulOlding! Worked perfectly 🙂