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
capko
Helper II
Helper II

Distinct elements related to another column

Hello,

 

I have the following table:

 

| A  | B  |
|----|----|
| A1 | M1 |
| A1 | M2 |
| A2 | M5 |
| A2 | M3 |
| A2 | M1 |
| A2 | M3 |
| A3 | M7 |
| A3 | M1 |

 

 

I need to find the distinct elements on the column 'A' and to create another column with the first element of the column 'B' found for the element in 'A'. The result will be something like this:

 

 

| A  | B  |
|----|----|
| A1 | M1 |
| A2 | M5 |
| A3 | M7 |

 

I've already tried several ways but I don't know how to obtain the final result...

5 REPLIES 5
capko
Helper II
Helper II

Does anyone knows how to help me with this one please ?

galaamri
Helper I
Helper I

Hi @capko 
In the power query view, choose remove duplicate under rows, and this should do it. or use distinct ( as a measure or calculated column)

I need to do it using DAX. I started like this:

 

Test=
VAR A = SUMMARIZE(Table;Table[A])
RETURN A

 

 

But with this I only can return a table with distinct elements

Measure =
 var _A = DISTINCT('Table'[A])
         return
         _A
    

It wont work as requested because the output wont be the same as the one shown in m first post

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.