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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
BI21
New Member

Extract unique values from multiple columns

Hello Power BI community,

I have been trying for some time now to figure out the solution to this problem (I am new to Power BI and DAX) but I could not find the solution myself or on the internet. The problem is pretty basic:

I have a table and I would like to extract the unique values from some of the columns. For example, from the following table I would like to have the unique values of columns 1, 2 and 3, so the answer would be A, B, C, D.

A

DC1
ACA2
BAB3
CBC4
DBA5
DBB6

 

Thanks in advance (also for redirecting me to relevant posts that I might have missed)!

 

3 REPLIES 3
cmouliscm
New Member

Hi,
I had a similar need, so i used the following steps: 
Created a new table using DAX UNION and DAX SELECTCOLUMNS,
New_table_name=
UNION(
SELECTCOLUMNS(source_table_name,"new_column_name",source_column_name1),
SELECTCOLUMNS(source_table_name,"new_column_name",source_column_name2),
SELECTCOLUMNS(source_table_name,"new_column_name",source_column_name3),
.
.
.
)

this will create a new table, with summarized columns. 

On top of this use DAX Measure , DISTINCTCOUNT or COUNTROWS(FILTER(table_name,NOT(ISBLANK(column_name))


This measure will help you to get a pivot table kind of result with individual columns.

From This

cmouliscm_0-1731076497110.png

to This:

cmouliscm_1-1731076509701.png

 

Idrissshatila
Super User
Super User

Hello @BI21 ,

 

like for example you could in power query, duplicate the table you have then remove all columns except the one you want to extract the values from then right click on this column and choose remove duplicates.

 

so you'll have every unique value in this column.

Idrissshatila_0-1681823001584.png

 

 

If I answered your question, please mark my post as solution so it would appeare to others, Appreciate your Kudos 👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Thank you for your hint! However, this only works when I apply it to one of the columns, not to several columns. So when I mark the first two columns of the example data and apply "Remove duplicates", it only removes the last row because the entry "D (in column 1) B (in column2)" is indeed a duplicate but the result is still a table. I want as answer only "A, B, C, D"

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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