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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
RJS849
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
v-yulgu-msft
Employee
Employee

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
v-yulgu-msft
Employee
Employee

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.
Ashish_Mathur
Super User
Super User

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


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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