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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
markmess77
Resolver I
Resolver I

How to return distinct values of a certain column when creating a new table?

I am creating a new table with DAX with something like the following

New Table =

DISTINCT (

     UNION (

          ALL(Table[CompanyName], Table[CompanyID])

    )

)

I am looking to return a new table based on distinct values of CompanyID. However, the dataset that I am working with has some minor differences in the CompanyName column despite having the same CompanyID. For example, I could have something like

CompanyNameCompanyID
ABC, Inc123
ABC Inc123

The result that I want is to only have only one instance of the `123` CompanyID value. It doesn't matter which CompanyName value corresponds with it.

I know I could just have another intermediate table and do something like Another Table = DISTINCT(Table[CompanyID]) and then make connect Another Table with New Table and I would eventually get the result that I want. But ideally I would like to avoid this and simply only return the distinct values of CompanyID in the first table that I created above.

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hello, @markmess77

You can do this with Power Query. I created data to play your scenario.

X:

c1.png

and:

c2.png

You can go to the "Start" ribbon, click "Add Queries".

c3.png

c4.png

You can then use 'Text Filter' to filter 'CompanyName' that contains ','.

c5.png

c6.png

result:

c7.png

Best regards

Allan

If this post helps,then please consider Accepting it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hello, @markmess77

You can do this with Power Query. I created data to play your scenario.

X:

c1.png

and:

c2.png

You can go to the "Start" ribbon, click "Add Queries".

c3.png

c4.png

You can then use 'Text Filter' to filter 'CompanyName' that contains ','.

c5.png

c6.png

result:

c7.png

Best regards

Allan

If this post helps,then please consider Accepting it as the solution to help the other members find it more quickly.

az38
Community Champion
Community Champion

Hi @markmess77 

for example you can create summarized table like

Table 2 = summarize('Table', 'Table'[CompanyID], "CompanyName",  FIRSTNONBLANK('Table'[CompanyName], 1))

 

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.