Forum Discussion
Getting distinct values for multiple columns
- 10 years ago
- 10 years ago
Hi Abhaykumar,
Use DAX and in DAX the function SUMMARIZE().
Summarize will pull out distinct values from columns.
So your resultset will be new table from Summarize
Table_Output = Summarize(Table_IN,Col1,Col2,Col3)
I hope it helps !
BR,
Achin
If you do it in DAX, just be aware that the full table must be loaded into the data model. Doing it in the query-editor using M would (mostly) fold back to the server, meaning that the SQL-server does the extraction and returns only the results to PBI to be loaded.
So if you need to load the full table anyway, DAX would probably be faster.
You can also wrap a DISTINCT(SELECTCOLUMNS(table, "col1name", Col1fromtable, table, "col2name", Col2fromtable)
- ToFrai8 years agoFrequent Visitor
How can I copy distinct values from multiple columns into ONE single colum?
The shown above always created multiple columns into which the code copies the distinct values from each column.
Thanks!
- ImkeF8 years agoCommunity Champion
This formula will create a list of distinct values in the query editor (where "Source" is the name of the table/previous step and column names in square brackets):
List.Distinct(List.Union({Source[Col1], Source[Col2], Source[Col3]}))Not sure if you want this as a standalone query or merge the resulting list with some other table?
- ToFrai8 years agoFrequent Visitor
Hi Imke,
thanks for the hint - where do I enter the code in the querie editor? Do I have to create a new table first, or add a new step in an existing query?
Problem is that the querie editor shows source tables only, not the ones I caclulated.
Isn't there a Dax formula that I can use in a new table that says something like "copy all (distinct) values from Table A Column 1, and then below all (distinct) valies from Table 2 Column 1, ...."?
BR | Tobias