Dax How to get distinct values from a column
18,034
Solution 1
If you are trying to simply create a new, single column table with the distinct values of an existing table, you can use the formula below.
Starting with data like this...
... simply create a new table with this formula to get a list of distinct values.
Locations = DISTINCT(Fruit[Location])
Solution 2
This will work:
Evaluate
VALUES('Table'[Column])
Author by
genie
Updated on June 23, 2022Comments
-
genie almost 2 years
This is the query I'm trying.
EVALUATE SELECTCOLUMNS('MyTable',"col1",DISTINCT(VALUES('MyTable'[Email])))
-
Joe Gravelyn over 6 yearsIn my example, yes
VALUES
will return the same results. According to the documentation, the functions are different and could return different results (see here) -
genie over 6 yearsYes just the values by itself works but if I have to put the values inside the selectcolumns it doesnot seem to work, as I have to select multiple columns here.
-
Joe Gravelyn over 6 years@genie Are you looking for a table with 2+ columns with all distinct combinations from the source columns?
-
genie over 6 years@Joe: Yes Joe i want to select more than one columns from different tables.
-
Joe Gravelyn over 6 years@genie: In that case, can you edit your question with more details? Preferably, show a diagram of your tables (and how they relate) and specify which columns you want in the distinct list (since you only have one in your question right now).