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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
iamprajot
Responsive Resident
Responsive Resident

Unique 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.

1 ACCEPTED SOLUTION

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

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

View solution in original post

8 REPLIES 8
danextian
Super User
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 blank

 

ColumnValues =
ALLNOBLANKROW ( 'Table'[Column] )
//excludes blank

 

ColumnValues =
DISTINCT ( 'Table'[Column] )

These will all return a table containing a column of unique values.

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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)
Anonymous
Not applicable

have you tried putting values around the table select columns statement

 

Table = VALUES ( SELECTCOLUMNS ( ..................... ) ) 

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)

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

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

Hi, @v-jiascu-msft .

 

I created a table that's a filtered version of one of my existing tables. Can I somehow reference this newly-created table in the summarize command to get only selected columns for the filtered table, or do I need to do a separate make table command to modify my filtered table? Here's the code to create the filtered table:

 

Household DQ Unit = 
    FILTER('Qualification Interactions', OR ('Qualification Interactions'[OUTCOME]="Disqualified for Business Unit", 'Qualification Interactions'[DISQUALIFIED FOR UI]=1) )

I think I was using summarize incorrectly, I did the same thing but didn't work and now it is working,
can you please provide similar alternative using SELECTCOLUMNS

Hi @iamprajot,

 

I'm afraid SELECTCOLUMNS wouldn't work in this scenario. Please refer to the definition of this function.

SELECTCOLUMNS(<table>, <name>, <scalar_expression> [, <name>, <scalar_expression>]…) 

Please mark the proper answer as solution if it helps.

 

Best Regards,

Dale

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.