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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Daniel48
Helper I
Helper I

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

 

 

1 ACCEPTED SOLUTION

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

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

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

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

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

That worked perfectly! Thank you for all of your help!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.