none
Default parameter to current MonthName in SSRS Report RRS feed

  • Question

  • Hi, 

    Similar questions have been asked and this one have helped me but it doesn't work for the MonthName Parameters : https://social.technet.microsoft.com/Forums/sqlserver/en-US/ea978ec4-ee51-46f0-93ca-3f118046e12a/default-parameter-to-current-year-in-ssrs-report?forum=sqlreportingservices

    I have a report parameter that selects a year and another one for MonthName. This list is populated through a dataset which is from a SSAS data source. I have one for Year and one for  monthName and they are both dimensions of [Dim Time].

    I've done this for the default value of the year parameter : ="[Dim Time].[Year].&["+CSTR(YEAR(NOW))+"]"

    and this for the MonthName : ="[Dim Time].[Month Name].&["+MONTHNAME(MONTH(NOW)) +"]"

    It's working fine for the year parameter but not for the MonthName, when i display it in  a textbox : it gives me :'[Dim Time]. [MonthName].[August], It means it's working, isn't it?  but it won't show as a default value.

    I'm sure the answer is easy but i can't find it out, i've been searching for a long time. Thanks

    Tuesday, August 13, 2019 1:59 PM

All replies

  • Hi,

    Are you sure about the expression? because with this expression "[Dim Time].[Month Name].&["+MONTHNAME(MONTH(NOW)) +"]", your output has to be : [Dim Time]. [Month Name].&[August] with space between "Month" and "Name" and "&" before the member and not [Dim Time]. [MonthName].[August] as you mentioned.


    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, August 13, 2019 2:30 PM
  • Hi,

    You're right it's "[Dim Time]. [Month Name].&[August] ", sorry i write it wrong. But it's empty  in the parameter.  


    Wednesday, August 14, 2019 6:03 AM
  • Hi 

    1) add dataset with following query's

    select year(GETDATE()) cntyear,Month(getdate()) cntmnt,Format(getdate(),'MMMM') cntmntname

    2)add parametr get values from query 

    for monthname choose clmntname  

    3) for year choose cntyear 

    After this check you texbox.

    Best Regards,

    Natig


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. 

    Wednesday, August 14, 2019 8:10 AM
  • Thanks for your answer , but what is the data Source that i have to use for this new dataset because all my dataset are from  a SSAS data source?
    Wednesday, August 14, 2019 8:21 AM
  • Hi,

    Try to add a textbox in your report and put the parameter value  (=Parameter!Name.Value) in this textbox to see how your members in ssas are written. so you can write the expression in the same way.


    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]

    Wednesday, August 14, 2019 8:25 AM
  • Hi Ousama,

    It's the same, on the right you have the "=Parameters!DimTimeMonthName.Value(0)" value and on the left

    the "="[Dim Time].[Month Name].&["+MONTHNAME(MONTH(NOW)) +"]"" value. I entered the April value in the Month Name Filter.


    • Edited by NyNava Wednesday, August 14, 2019 8:44 AM
    Wednesday, August 14, 2019 8:43 AM
  • Can i new datasource from database engine ? In this case you must have any datasource that is way running sql query.
    Wednesday, August 14, 2019 8:43 AM
  • Hi Ousama,

    It's the same, on the right you have the "=Parameters!DimTimeMonthName.Value(0)" value and on the left

    the "="[Dim Time].[Month Name].&["+MONTHNAME(MONTH(NOW)) +"]"" value. I entered the April value in the Month Name Filter.


    Ok, I don't see why it is not working. If you put the expression above in the default value of your parameter, normally you will have the August month selected. It is weird.

    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]

    Wednesday, August 14, 2019 8:58 AM
  • I thought it will work but no, it's empty for the year and the monthname parameter... i really don't understand
    Wednesday, August 14, 2019 9:01 AM
  • It should work but it's not, i tried this in the default value "[Dim Time].[Month Name].&[August]" but it's still empty
    Wednesday, August 14, 2019 9:07 AM
  • It should not act this way, maybe do more check and remake the report step by step?

    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 16, 2019 6:39 AM