Wednesday, April 16, 2014

Function to Only Display Last Word in SSRS

Josh,

So you have an MDX query that returns back months like "FY 2013 - 2014 January", but you only want to show "January" on the report.

Here is the function to accomplish this:


=Right(
    
Fields!Case_Management_Month.Value,
    
Len(Fields!Case_Management_Month.Value)
    -
InStrRev(Fields!Case_Management_Month.Value, " ")
)

Functions Used:

  • Right(A1, A2): Starting from the right side of A1, take the number of characters as indicated by A2
  • Len(A1): Returns the character length of A1
  • InStrRev(A1, A2): Returns the first location of A2 within A1 starting from the right

No comments:

Post a Comment

Please only include comments that add to the substance of the Blog Post:
- Question or request for clarification
- Idea for improvement
- Identifying an issue

Please refrain from promotion.