SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSRS- Set default date to max date from dataset


SSRS- Set default date to max date from dataset

Author
Message
vilenvmo
vilenvmo
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 5
Hi All

I have a dateset for parameter that is filtered to only have the months where we have transactions or values for. In this case it is 3 months which will appear as multivalue drop down (Oct-17,Nov-17,Dec-17). i tried number of ways using combination of MDX and expressions to set the default as the Max or last date of the month. Which should be Dec 2017. How can I do this? Note the dataset was built using MDX designer
sgmunson
sgmunson
SSC Guru
SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)

Group: General Forum Members
Points: 98425 Visits: 7265
vilenvmo - Monday, February 26, 2018 5:23 AM
Hi All

I have a dateset for parameter that is filtered to only have the months where we have transactions or values for. In this case it is 3 months which will appear as multivalue drop down (Oct-17,Nov-17,Dec-17). i tried number of ways using combination of MDX and expressions to set the default as the Max or last date of the month. Which should be Dec 2017. How can I do this? Note the dataset was built using MDX designer

Not sure exactly what you mean by "I have a dataset for parameter". If you are using a dataset as a source for a parameter, that query would have to be able to be added with a maximum value specified, to the default value specification, based on what you're saying. I think you need to determine that maximum value by in some way ranking all the supplied values and creating an additional column to hold that ranking value, and then use a pair of columns from that query, maybe... Not sure it can be done without some form of hard coded value...


Steve
‌(aka sgmunson)
Smile Smile Smile
Health & Nutrition
vilenvmo
vilenvmo
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 5
Hi Steve.

I am an SSRS newbie. Thanks for your response here is what I tried thus far in parameters > Default Value> exp>
="[Date].[Date].&[" & YEAR(DateAdd("m",-1,NOW()))*100
+MONTH(DateAdd("m",-1,NOW())) & "]"
But issue is aggregations such as max doesnt work here. Im trrying to do it in MDX ....as per below, so still no luck...my ultimate objective is what ever dates as in "MMM-YY" format , default parameter to select latest or max date/lastdate.


WITH MEMBER [Measures].[Caption]
AS VBA!Format
(
Cdate([Date].[Date].CurrentMember.Name)
,"MMM-yy"
)
MEMBER [Measures].[Key]
AS [Date].[Date].CurrentMember.UNIQUE_NAME
//MEMBER [Measures].[SortMe]AS [Date].[Date].CurrentMember.UNIQUE_KEY

MEMBER [Measures].[Risk] AS [Measures].[Total Risks]

MEMBER [MaxDate] as Max([Measures].[Caption])

SELECT NON EMPTY {[Measures].[Caption], [Measures].[Key],[Measures].[Risk],[Measures].[MaxDate]
//, [Measures].[SortMe]
} ON 0

, {[Date].[Year Month].[Year Month]
* [Date].[Date].[Date] } ON 1

FROM [Model]
WHERE ([Date].[DayofMonth].&[1])
sgmunson
sgmunson
SSC Guru
SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)

Group: General Forum Members
Points: 98425 Visits: 7265
Why are you trying to format the data within MDX? SSRS is where that formatting needs to be. Values coming from your MDX query that are actually dates instead of character strings, might give you a better chance...

Steve
‌(aka sgmunson)
Smile Smile Smile
Health & Nutrition
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum









































































































































































SQLServerCentral


Search