Forum Discussion

Daniel48's avatar
Daniel48
Icon for Helper I rankHelper I
2 years ago
Solved

Union three columns across three tables

Hello, 

 

Is it possible to create a column that only has distinct values from 3 columns on 3 different tables. I found the formula below but it keeps giving me errors.

 


Thank you in advance!

 

 

Country = FILTER(
    DISTINCT(UNION(VALUES('4 - Data (CSAT)'[Country]), VALUES('4 - Data (Voice)'[Country]))),
    [Country] <> BLANK()
)

 

 

  • try this

     

    Master Policy Table =
    FILTER (
        DISTINCT (
            UNION (
                VALUES ( 'policy finance_Initial'[policy_uniqueid] ),
                VALUES ( 'policy finance_target'[policy_uniqueid] ),
                VALUES ( 'policy premium'[policy_uniqueid] )
            )
        ),
        [policy_uniqueid] <> BLANK ()
    )

4 Replies

  • Before you can do a UNION your columns need to have the same name.  Use SELECTCOLUMNS  to rename them as needed.

    • Daniel48's avatar
      Daniel48
      Icon for Helper I rankHelper I
      Master Policy Table = FILTER(DISTINCT(UNION(VALUES('policy finance_Initial'[policy_uniqueid]),VALUES('policy finance_target'[policy_uniqueid]),VALUES('policy premium'[policy_uniqueid])),
          [policy_uniqueid] <> BLANK()))
       
      I have renamed the columns but I am getting the error. Too many arguments were passed to the DISTINCT function. The maximum argument count for the function is 1. I can get it with two columns but not three
      • lbendlin's avatar
        lbendlin
        Icon for Super User rankSuper User

        try this

         

        Master Policy Table =
        FILTER (
            DISTINCT (
                UNION (
                    VALUES ( 'policy finance_Initial'[policy_uniqueid] ),
                    VALUES ( 'policy finance_target'[policy_uniqueid] ),
                    VALUES ( 'policy premium'[policy_uniqueid] )
                )
            ),
            [policy_uniqueid] <> BLANK ()
        )