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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Need help to rank non numeric data

 I have recently stated working on power bi and I'm struggling with this below mentioned scenario. your help will be appreciated 🙂   I wanted to rank some non character data in power bi using a measure. if there are two product id matched to one type it should rank them in alphabetical order. 

 

can you guys help ->       @amitchandak @Fowmy @AllisonKennedy @lbendlin 

Data :

Product Idtype
11456A
11456B
11457A
11458A
11458B
45821B

 

 

Output 

 

Product IdtypeRank
11456A1
11456B2
11457A1
11458A1
11458B2
45821B1
1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

You can try this as a calculated COLUMN:

Rank Dax = RANKX(FILTER(ALL('Table'), 'Table'[Product Id] = EARLIER('Table'[Product Id])), 'Table'[type],,ASC)

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

7 REPLIES 7
AllisonKennedy
Super User
Super User

You can try this as a calculated COLUMN:

Rank Dax = RANKX(FILTER(ALL('Table'), 'Table'[Product Id] = EARLIER('Table'[Product Id])), 'Table'[type],,ASC)

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

getting error as parameter is not of correct type in earlier function

are you doing as calculated column or measure? What is the exact error message you're getting?

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

@AllisonKennedy I'm creating a measure to achive this and getting an error in EARLIER function as "Parameter is not of correct type"Please do let me know if there any other way to achieve this.

To use EARLIER in this context it must be a calculated COLUMN. Not measure.

If you want to use a measure it could possibly be done with the use of variables.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

It worked :).
Thanks

You're welcome. Glad it worked 🙂

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.