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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
jzhao
Frequent Visitor

values and distinc function input

I want to retrieve unique rows from three different columns in three different tables. Then, I want to filter out rows that contain `*` or are blank. The following code provides the desired result:

 

All projects =
FILTER(
    DISTINCT(
            UNION(
                VALUES('table1'[column 1 clean]),VALUES('table 2'[column2 clean])
                )
            ),
    IF([Cust_Po_num_Clean]<>BLANK()&&[Cust_Po_num_Clean]<>"0" && [Cust_Po_num_Clean]<>"#",TRUE(),FALSE())
    )
 
However, the following code generates an error:
All projects =
FILTER(
    Values(
            UNION(
                VALUES('table1'[column 1 clean]),VALUES('table 2'[column2 clean])
                )
            ),
    IF([Cust_Po_num_Clean]<>BLANK()&&[Cust_Po_num_Clean]<>"0" && [Cust_Po_num_Clean]<>"#",TRUE(),FALSE())
    )

What could be the reason for the error?

2 REPLIES 2
Anonymous
Not applicable

Hi @jzhao ,

The reason for the error in your second code is that you are using the VALUES function instead of the DISTINCT function to return a table of unique rows. The VALUES function returns a one-column table that contains the distinct values from the specified column, optionally ignoring any blank values. However, in your case, you are passing a table expression to the VALUES function, which is not a valid argument. The VALUES function expects a column reference as its input parameter.

The DISTINCT function, on the other hand, returns a table by removing duplicate rows from another table or expression. The DISTINCT function can take any table expression as its input parameter, and it will return a table with the same columns and only distinct rows.

Therefore, to fix your error, you need to replace the VALUES function with the DISTINCT function in your second code, as you did in your first code. This will ensure that you are passing a valid table expression to the FILTER function, and that you are getting a table of unique rows from three different columns in three different tables.

 

Solved: Find and Replace values either by a measure and or... - Microsoft Fabric Community

DISTINCT (table) function (DAX) - DAX | Microsoft Learn

powerbi - DAX Query to Get Distinct Items from Multiple Tables - Stack Overflow

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

some_bih
Community Champion
Community Champion

Hi @jzhao UNION function features: The two tables must have the same number of columns. In example column1 clean and column2 clean 

https://learn.microsoft.com/en-us/dax/union-function-dax?WT.mc_id=DP-MVP-4025372 

Did I answer your question? Kudos appreciated / accept solution!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.