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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.