Forum Discussion
iamprajot
Responsive Resident
8 years agoUnique records in SELECTCOLUMNS
I want to get a list of unique records in a new Table which is created using SELECTCOLUMNS.
Currently I am getting all the records which contains duplicate records.
Hi iamprajot,
1. Extract more than one column.
Table = ALL('Table1'[Column1], 'Table1'[Column2])2. Formula for your scenario.
Table = summarize('table1', 'table1'[OrderID], "sum", sum('table1'[Price])Please give them a try.
Best Regards,
Dale
8 Replies
- danextian
Super User
Hi iamprajot,
If I understand correctly, you are using SELECTCOLUMNS() to extract values of a column from a table? If so, you can do either:
ColumnValues = VALUES ( 'Table'[Column] )
ColumnValues = ALL('Table'[Column])
//may contain blankColumnValues = ALLNOBLANKROW ( 'Table'[Column] ) //excludes blank
ColumnValues = DISTINCT ( 'Table'[Column] )
These will all return a table containing a column of unique values.
- iamprajot
Responsive Resident
I know all these and it works if we just need 1 column
BUT the catch is if we need multiple columns, for eg, 1 unique column like OrderID and other columns tat contains aggregates.
TableName,
"Column1", Values(OrderID),
"Column1", SUM(Price)
- AnonymousNot applicable
have you tried putting values around the table select columns statement
Table = VALUES ( SELECTCOLUMNS ( ..................... ) )
- iamprajot
Responsive Resident
I know all these and it works if we just need 1 column - Inside Values we cannot put SELECTCOLUMNS if SELECTCOLUMNS is having multiple columns
BUT the catch is if we need multiple columns, for eg, 1 unique column like OrderID and other columns tat contains aggregates.
TableName,
"Column1", Values(OrderID),
"Column1", SUM(Price)- v-jiascu-msft
Microsoft Employee
Hi iamprajot,
1. Extract more than one column.
Table = ALL('Table1'[Column1], 'Table1'[Column2])2. Formula for your scenario.
Table = summarize('table1', 'table1'[OrderID], "sum", sum('table1'[Price])Please give them a try.
Best Regards,
Dale