cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RJS849 Frequent Visitor
Frequent Visitor

To create table using distinct values and using the filter to remove blanks

I need to create a table from two tables by combining distinct values but at the same time using filter to remove any blank values

 

NEWTable1 = DISTINCT(UNION(VALUES(Table1[Dept_ID]), VALUES(Table2[DeptID])))

 

When it create this new table "NEWTable1", it needs to filter out blank values from Table1 and Table2 which have Dept_ID or DeptID blanks. So that the new column created from these two tables won't have any blank values.

 

Table1

A100
A101
 
A103
A104

 

Table2

B201
B204
B205
B205
 

 

 

NewTable1

A100
A101
A103
A104
B201
B204
B205
B205
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
v-yulgu-msft Super Contributor
Super Contributor

Re: To create table using distinct values and using the filter to remove blanks

Hi @RJS849,

 

Please try:

NEWTable1 =
FILTER (
    DISTINCT ( UNION ( VALUES ( Table1[Dept_ID] ), VALUES ( Table2[DeptID] ) ) ),
    [Dept_ID] <> BLANK ()
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: To create table using distinct values and using the filter to remove blanks

Hi,

 

You can solve it using thise code in the Query Editor

 

let
    Source = Table.Combine({Table1, Table2}),
    #"Filtered Rows" = Table.SelectRows(Source, each ([Codes] <> "")),
    #"Removed Duplicates" = Table.Distinct(#"Filtered Rows")
in
    #"Removed Duplicates"

 

Untitled.png

Highlighted
v-yulgu-msft Super Contributor
Super Contributor

Re: To create table using distinct values and using the filter to remove blanks

Hi @RJS849,

 

Please try:

NEWTable1 =
FILTER (
    DISTINCT ( UNION ( VALUES ( Table1[Dept_ID] ), VALUES ( Table2[DeptID] ) ) ),
    [Dept_ID] <> BLANK ()
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 352 members 3,636 guests
Please welcome our newest community members: