Forum Discussion

mathieu_thelot's avatar
mathieu_thelot
Frequent Visitor
10 years ago

distinct values of two rows

I want to create a column with Distinct value of row_1 and row_2

 

row_1 is in a table_1, and row_2 in an other table_2

 

so to have unique value 

 

var_1 = distinct( table_1[row_1])

var_2 = distinct( table_2[row_2])

 

Is there a way to create a row_uniq of this 2 tables ?

something like var = distinct( table_1[row_1]) && distinct( table_2[row_2])

2 Replies

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Icon for Community Support rankCommunity Support

    Hi mathieu_thelot,

     

    In your scenario, if the table contains var_1 and the table contain var_2 are related, you can combine those two columns from different tables with Related() function. Please refer to this article: Tutorial: Create calculated columns in Power BI Desktop.

     

    But if distinct value from var_1 and var_2 contain the same value (eg: var_1 returns "a,b,c", and var_2 returns "a,d,e"), when you concatenate them, they will return "a a", is that what you want? In your scenario, I would suggest you merge those two tables table_1 and table_2 use Append Queries in Query Editor, then row_1 and row_2 will stay in the same column(eg:"a,b,c,a,d,e"). You can use Distinct() function to return unique values from this new column(eg:"a,b,c,d,e").

     

    If you have nay question, please feel free to ask.

     

    Best Regards,
    Qiuyun Yu