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
jimmyfromus
Helper III
Helper III

Adding nd, st etc to a number column

Hi, 

 

I've a standard number column that I'm adding to a card visual in a dashboard in powerbi. I would like however to add st to 1 and nd to 2 etc. The visual looks like this, instead of 69, I would like 69th in the card visual. 

pic89.JPG

 

How could I do this? Thank you.

2 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@jimmyfromus your answers are so short it is wasting our time. Are you adding a new column or a measure? Why not explain everything in one go. Just a suggestions.

 

Since Rank is a column and if you are adding a measure, as suggested, use aggregation for Rank in this measure, for example, MOD ( SUM ( Table[Rank] ), 100 )

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

@parry2k Sorry about any confusion, I had written I had a standard number column. Your last suggestion works for me. 🙂 -> MOD ( SUM ( Table[Rank] ), 100 ). I appreciate your help. 

 

The solution I am now using is below where Comparison [rank] is a whole number column. 

Ordinal Suffices =

SWITCH(

TRUE()

,MOD ( SUM ( Comparison[rank] ), 100 ) IN{11,12,13} ,"th"

,MOD ( SUM ( Comparison[rank] ),10) = 1 ,"st"

,MOD( SUM ( Comparison[rank] ),10) = 2 ,"nd"

,MOD( SUM ( Comparison[rank] ),10) = 3 ,"rd"

,"th"

)

View solution in original post

9 REPLIES 9
parry2k
Super User
Super User

@jimmyfromus your answers are so short it is wasting our time. Are you adding a new column or a measure? Why not explain everything in one go. Just a suggestions.

 

Since Rank is a column and if you are adding a measure, as suggested, use aggregation for Rank in this measure, for example, MOD ( SUM ( Table[Rank] ), 100 )

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Sorry about any confusion, I had written I had a standard number column. Your last suggestion works for me. 🙂 -> MOD ( SUM ( Table[Rank] ), 100 ). I appreciate your help. 

 

The solution I am now using is below where Comparison [rank] is a whole number column. 

Ordinal Suffices =

SWITCH(

TRUE()

,MOD ( SUM ( Comparison[rank] ), 100 ) IN{11,12,13} ,"th"

,MOD ( SUM ( Comparison[rank] ),10) = 1 ,"st"

,MOD( SUM ( Comparison[rank] ),10) = 2 ,"nd"

,MOD( SUM ( Comparison[rank] ),10) = 3 ,"rd"

,"th"

)
parry2k
Super User
Super User

@jimmyfromus rank is a measure or a column? 

 

Are you adding a measure or a column? If Rank is a column and you are adding a measure then you should use aggregation to use rank in your measure.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

it's a column

parry2k
Super User
Super User

@jimmyfromus what is the data type of Rank column?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k whole number

parry2k
Super User
Super User

@jimmyfromus try this logic 

 

Number with Postfix = 
VAR __remainder = MOD ( [YourMeasure], 10 )
VAR __postFix = 
SWITCH ( 
    __remainder,
    1, "st",
    2, "nd",
    3, "rd",
    "th"
) 
RETURN
FORMAT ( [YourMeasure], "General Number" ) & __postFix

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Thanks. I've tried the following but my number column doesn't seem to be picked up. What am I doing wrong here? Thanks again. 

pic90.JPG

StefanoGrimaldi
Resident Rockstar
Resident Rockstar

try out the smart narrative: https://docs.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-smart-narrative 

you can costoum made text combined with values or results. 





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




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.