none
SSRS: Sort by Monthnumber not by Alphabetical RRS feed

  • Question

  • Hello Everyone - I created a report which displays the data for last 3 month only. This is May, so the report pulls data for April March and Feb. 

    I want my report MOnth value to show up in Chronological order like April, March and Feb. 

    But its showing as April, Feb, March (May be its taking as Alphabetical order. Please see below 

    below is the screenshot and the group properties value.

    I want to be displayed as April, March, Feb.

    • Edited by kkran Tuesday, May 7, 2019 3:42 PM Removed Screenshots
    Tuesday, May 7, 2019 2:23 PM

Answers

  • Hi,

    In your dataset add a calculated field that bring you the month's number from the month's name with this expression :

    =Switch(Fields!month.Value="January","01",Fields!month.Value="February","02",Fields!month.Value="March","03",Fields!month.Value="April","04",Fields!month.Value="May","05",Fields!month.Value="June","06",Fields!month.Value="July","07",Fields!month.Value="Augest","08",Fields!month.Value="September","09",Fields!month.Value="October","10",Fields!month.Value="November","11",Fields!month.Value="December","12")

    And then you can sort your tablix with this new field.


    Ousama EL HOR

    [If a post helps to resolve your issue, please click the "Mark as Answer"  of that post or click Answered "Vote as helpful"  button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]


     [User Page]     [MSDN Page]     [Blog]     [Linkedin]

    • Marked as answer by kkran Tuesday, May 7, 2019 3:40 PM
    Tuesday, May 7, 2019 2:31 PM
  • I modified the expression as below, my month values includes year too: 
    =Switch(Fields!MOnth.Value="January,2019","01",Fields!MOnth.Value="February,2019","02",Fields!MOnth.Value="March,2019","03",Fields!MOnth.Value="April,2019","04",Fields!MOnth.Value="May,2019","05",Fields!MOnth.Value="June,2019","06",Fields!MOnth.Value="July,2019","07",Fields!MOnth.Value="August,2019","08",Fields!MOnth.Value="September,2019","09",Fields!MOnth.Value="October,2019","10",Fields!MOnth.Value="November,2019","11",Fields!MOnth.Value="December,2019","12")

    Now its working. Thanks
    • Edited by kkran Tuesday, May 7, 2019 3:39 PM
    • Marked as answer by kkran Tuesday, May 7, 2019 3:40 PM
    Tuesday, May 7, 2019 3:37 PM

All replies

  • Hi,

    In your dataset add a calculated field that bring you the month's number from the month's name with this expression :

    =Switch(Fields!month.Value="January","01",Fields!month.Value="February","02",Fields!month.Value="March","03",Fields!month.Value="April","04",Fields!month.Value="May","05",Fields!month.Value="June","06",Fields!month.Value="July","07",Fields!month.Value="Augest","08",Fields!month.Value="September","09",Fields!month.Value="October","10",Fields!month.Value="November","11",Fields!month.Value="December","12")

    And then you can sort your tablix with this new field.


    Ousama EL HOR

    [If a post helps to resolve your issue, please click the "Mark as Answer"  of that post or click Answered "Vote as helpful"  button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]


     [User Page]     [MSDN Page]     [Blog]     [Linkedin]

    • Marked as answer by kkran Tuesday, May 7, 2019 3:40 PM
    Tuesday, May 7, 2019 2:31 PM
  • Please see below, its still showing the same. 

    Am i doing it right ?

    • Edited by kkran Tuesday, May 7, 2019 3:42 PM removed screenshots
    Tuesday, May 7, 2019 2:42 PM
  • Use just Fields!MonthSort.Value, you don't need to use Year function.

    Ousama EL HOR

    [If a post helps to resolve your issue, please click the "Mark as Answer"  of that post or click Answered "Vote as helpful"  button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]


     [User Page]     [MSDN Page]     [Blog]     [Linkedin]

    Tuesday, May 7, 2019 3:10 PM
  • I modified the expression as below, my month values includes year too: 
    =Switch(Fields!MOnth.Value="January,2019","01",Fields!MOnth.Value="February,2019","02",Fields!MOnth.Value="March,2019","03",Fields!MOnth.Value="April,2019","04",Fields!MOnth.Value="May,2019","05",Fields!MOnth.Value="June,2019","06",Fields!MOnth.Value="July,2019","07",Fields!MOnth.Value="August,2019","08",Fields!MOnth.Value="September,2019","09",Fields!MOnth.Value="October,2019","10",Fields!MOnth.Value="November,2019","11",Fields!MOnth.Value="December,2019","12")

    Now its working. Thanks
    • Edited by kkran Tuesday, May 7, 2019 3:39 PM
    • Marked as answer by kkran Tuesday, May 7, 2019 3:40 PM
    Tuesday, May 7, 2019 3:37 PM