cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jmg80525 Frequent Visitor
Frequent Visitor

Sort Array ASC Label Members as BEG, MID and END

Greetings.  I prefer to be able to do this utilizing M instead of DAX.  I have a table that will have two columns: one is the ID (Text) and the other, MD, contains integers.  I want to sort the table and then calculate a new column called POSITION to identify the first member of each unique ID array as BEG, the last as END, and all others as MID.  Example:

ID     MD    POSITION

A       1       BEG

A       2       MID

A       3       MID

A       4       END

B       3       BEG

B       7       MID         

B     12       MID

B     30       END

.....

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User I
Super User I

Re: Sort Array ASC Label Members as BEG, MID and END

You can groupby the following:

Group.png

Expand the table out

Add a conditional column with


Condition Column.png

Remove columns and set data types. Final Table:

Final Table.png

View solution in original post

1 REPLY 1
Super User I
Super User I

Re: Sort Array ASC Label Members as BEG, MID and END

You can groupby the following:

Group.png

Expand the table out

Add a conditional column with


Condition Column.png

Remove columns and set data types. Final Table:

Final Table.png

View solution in original post

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors