SSRS Report Builder: Default Value of Date Parameter Unresponsive - report

I have a report that has Period, From Date, and To Date parameters. The Period is the number of months that should be between the From Date and To Date parameters by default. The From Date defaults to the system date.
The functionality I need is that if someone should change the From Date or Period parameters, the To Date should update automatically to the correct value. I also need to allow all three parameters to be manually alterable by the end user.
The default for the From Date works fine.
So far I have tried the following:
Using an SSRS expression to set the To Date Default value. This works correctly when I put a value into the Period parameter, however when I change that value the To Date does not update.
Using a dataset to set the To Date Default value. This has the same result as (1).
Using a dataset to set the Default and Available values to the calculated value. This updates correctly, however it becomes a none interactive parameter.
Using a helper parameter, with Default and Available values set as (3), then using this parameter as the default for To Date. This works correctly, producing the functionality I want, but it leaves a none interactive parameter on the parameters list, which is aesthetically undesirable.
Doing as (4), but making the helper parameter hidden. This reverts to the same functionality as (1).
Doing as (4), but making the parameter internal. This reverts to the same functionality as (1).
All parameters are set to Always Refresh. I don't understand why hiding the parameter makes it work differently, and I've run out of ideas for how to do this. Any suggestions would be very much appreciated.

Related

Set moment date after setting the utcOffset

I'm looking to set a date on the YYYYMMDD that should be referencing to a date on a specific utcOffset. But I'm not sure what would be the best and elegant way to set this date after setting the utcOffset.
The close I can get is the following but its not the actual result I want. I need a way to first set the offset and then set the YYYYMMDD based on this offset.
moment.utc(ymdDate, 'YYYYMMDD').utcOffset(timeOffset)
Example:
In case I had a date like 20190420 that must be used on a moment object that should be referring to a different timezone and I do the following the date would result in April 19th.
moment.utc(20190420, 'YYYYMMDD').utcOffset(-300).format()
Result:
2019-04-19T19:00:00-05:00
Expected Result:
2019-04-20T00:00:00-05:00
You can use utcOffset passing true as second parameter
The utcOffset function has an optional second parameter which accepts a boolean value indicating whether to keep the existing time of day.
Passing false (the default) will keep the same instant in Universal Time, but the local time will change.
Passing true will keep the same local time, but at the expense of choosing a different point in Universal Time.
Here a live sample:
console.log( moment.utc(20190420, 'YYYYMMDD').utcOffset(-300, true).format() );
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>

"Calculated columns cannot contain volatile functions like Today and Me" error message on Sharepoint

I try to add a new calculated column to sharepoint list that will show elapsed day. I enter name and write a formula like;
=ABS(ROUND(Today-Created;0))
The data type returned from this formula is: Single line of text
When I want to save I get an error like
Calculated columns cannot contain volatile functions like Today and
Me.
Calculated Column Values Only Recalculate As Needed
The values in SharePoint columns--even in calculated columns--are stored in SharePoint's underlying SQL Server database.
The calculations in calculated columns are not performed upon page load; rather, they are recalculated only whenever an item is changed (in which case the formula is recalculated just for that specific item), or whenever the column formula is changed (in which case the formula is recalculated for all items).
(As a side note, this is the reason why in SharePoint 2010 you cannot create or change a calculated column on a list that has more than the list view threshold of 5000 items; it would require a mass update of values in all those items, which could impact database performance.)
Thus, in order for calculated columns to accurately store "volatile" values like "Me" and "Today", SharePoint would need to somehow constantly recalculate those column values and continuously update the column values in the database. This simply isn't possible.
Alternatives to Calculated Columns
I suggest taking a different approach entirely instead of using a calculated column for this purpose.
Conditional Formatting: You can apply conditional formatting to highlight records that meet certain criteria. This can be done using SharePoint Designer or HTML/JavaScript.
Filtered List views: Since views of lists are queried and generated in real time, you can use volatile values in list view filters. You can set up a list view web part that only shows items where Created is equal to [Today]. Since you can place multiple list view web parts on one page, you could have one section for today's items, and another web part for all the other items, giving you a visual separation.
A workflow, timer job, or scheduled task: You can use a repeating process to set the value of a normal (non-calculated) column on a daily basis. You need to be careful with this approach to ensure good performance; you wouldn't want it to query for and update every item in the list if the list has surpassed the list view threshold, for example.
I found some conversations about this issue. Many people suggest to creating a new Date Time column, visible is false, default value is Today's Date and it will be named as Today. Then we can use this column in our formulas.
I tried this suggestion and yes error is gone and formula is accepted but calculated columns' values are wrong. I setted column Today is visible and checked, it was empty. Default value Today's Date was not working. When I looking for a solution for this issue I deleted column Today carelessly. Then I realized calculated columns' values are right.
Finally; I don't know what is trick but before using Today keyword in your formulas if you create a column named as Today and after your formula saving if you delete Today column, it is working.
UPDATE
After #Thriggle's answer I realized this approach doesn't work like a charm. Yes, formula doesn't cause an error when calculated column saving but it works correctly only first time, in the next day the calculated column shows old values, because its values are static as Thriggle explained.

Cognos 10.2 - date range default earliest vs today

Very simple question (hopefully) but I can't find the answer anywhere. I have two seemingly identical date prompts for optional date ranges. One defaults to today's date. The other defaults to 'earliest' and 'latest'. But I can't for the life of me find the setting that controls this.
(I'm not trying to do anything advanced such as dynamical defaults, using javascript.)
Please help. Thanks.
A single-select date prompt with the Required property set to 'No' and the Range property set to 'Yes' will show the Earliest and Latest radio buttons and have them selected as default. When the Required property is set to 'Yes' the date prompts default to the current date. Thus, your two date prompts likely have different settings for the Required property.

How to set the entire date/time for an instance?

I'm adding an extension function to Moment and it needs to change the entire Moment instance to a new date/time value. However, the available Set methods only seem to allow setting specific units (ie. day, month, hour, second).
I understand that it would probably be possible to do:
this.set('year', year);
this.set('month', month);
...
but this seems ugly and possibly error-prone (if the values adjust for temporarily invalid date/times).
You can get Date from that moment values and then use setMinutes, setYear, setMonth etc. functions on that date object.

How can I get results for a dimension (custom variables), where the value is not set?

I am using custom variables to track order ids. In order to aggregate analytics data into out data warehouse, I want to select a number of metrics with the custom variable as a dimension. However, if I do so, I will not get the entries where the variable is not set (E.g. sessions that didn't result in a sale). I need to get these as well.
Can I write a filter or segment that selects only the entries that doesn't have a particular custom variable? I have tried:
segment=dynamic::ga:customVarValue1==
But that doesn't seem to work (It gives no results back).
Basically I'm looking for the equivalent to where ga:customVarValue1 is null in sql.
In short, it's not possible to get the nullset data, as explained by a Google rep:
For some dimensions, GA uses the default value of (not set).
Custom Variable do not have a default value, so if a hit does not have a
custom variable associated with it, all the other dimensions in the query
are not added to the reports.
The original answer is a little confusing, but when you read between the lines it suggests that they throw out these "empty" values when they run their aggregates.
The "correct" approach, as he explains, is to set a default value for any row you want reported:
If you need to see the (not set) value, you could try sending a default
value for custom variables.
For example if you use visitor level custom vars to track member vs
non-member, you should always set non-member as a default for everybody;
then modify to member once they register.
Details are here: http://groups.google.com/group/google-analytics-data-export-api/browse_thread/thread/cd078ddb26ca18d5?pli=1
I've just had some success solving this by using a Regex to capture users or sessions where the custom dimension has no value. In my case I want to separate logged in and logged out users.
The Regex .+ will capture any non-empty value, so can be used to get the job done.
The filters for my Returning users segment is matches regex: .+ like this:
For the Customer prospects I used: does not match regex: .+ like this:
It's early days, but this appears to be working:

Resources