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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
JD193704
Frequent Visitor

Calculated column to count unique expressions of other column

Hello,

 

what I am looking for seems pretty simple. I have on column with a few different expressions. As long there is the same expression inside, the calculated column should always show "1". First if there comes up a new expression, it should switch to "2". A example is shown in the table below. Should I use the INDEX function or any kind of COUNT function or something completely different? 

Thankful for any help!

Column 1Calculated Column
ABC1
ABC1
ABC1
ABC1
EFG2
EFG2
HIJ3
HIJ3

 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @JD193704 
You can create the calculated column with the following Dax :

UniqueRank = RANKX(ALL('Table'), 'Table'[Column 1],,ASC,Dense)
Ritaf1983_0-1697126456381.png

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @JD193704 
You can create the calculated column with the following Dax :

UniqueRank = RANKX(ALL('Table'), 'Table'[Column 1],,ASC,Dense)
Ritaf1983_0-1697126456381.png

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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