SSRS date expression tweak - ssrs-2012

In SSRS I am currently using this expression:
=IIF(Today() >= DateSerial(Year(Today()), 4, 1),DateSerial(Year(Today()), 4, 1), DateSerial(Year(Today()) - 1, 4, 1))
In a date parameter (default values, specify values). This gives me 01/04/2018.
However for one particular report it would be helpful for the date to default to the previous year - e.g. 01/04/2017.
I've tried to tweak the above expression to make this work, but haven't succeeded. Can this expression be changed to go back one year?
Thanks.

=IIF(Today() >= DateSerial(Year(Today()), 4, 1),DateSerial(Year(Today())-1, 4, 1), DateSerial(Year(Today())- 2, 4, 1))

Related

Hide value in filter - Tableau

I have a problem with Filters.
I have a dimension with the values (0, 1, 2, 3, 4, 5).
I want to use this dimension as a filter, but not to let the user the option to filter out the value "0".
I don't want to exclude the values 0, the opposite - I want these values to ALWAYS be in the view, and let the user the chance to filter only between (1, 2, 3, 4, 5).
Is that an option? To remove a value from the filter but not from the data?
Any help would be very appreciated
Thank you!!
If I understood your question correctly then my answer is - Yes, there is a way to do so.
Let's say your dimension name is 'dim_field' having value (0, 1, 2, 3, 4, 5) then
Create a parameter - let's name it as 'parm_field'. In create parameter window select 'data type' as string, 'Allowable values' as list, 'set from field' as dim_field (i.e. you dimension) and add one more row in this list as 'All'. Drag this row to top and select 'current value' as 'All'. Most importantly delete row having '0', as you don't want this to be in your filter and click ok.
Click on this parameter and select 'Show Parameter Control'
Create a calculated field 'is_DimField_selected' and define it as:
IF [parm_field] == 'All' THEN 'Y'
ELSE
IF [parm_field]=[dim_field] THEN 'Y'
ELSE 'N'
END
END
Add this calculated field to filter and select 'Y'. Voila!
Kindly don't forget to mark as answer if it solves your problem ;)

How can we format a currency using culture group size in Kendo numeric text box?

I am using Kendo numericTextBox to display the currency. I have a requirement to format the value based on the currency selected. I am able to format the currency correctly for "en-US" and "de-DE" but I'm having trouble to format the currency correctly for culture have different group size.
All the example and sample in Kendo blog are on "en-US" and "de-DE" which have similar group size.
For "en-US" currency groupSize property is [3] what means that each group will be separated after 3 digits e.g. 1,000,000. But for some other culture which have different grouping, e.g. "en-IN" which have the 'groupSize' equals [3,2,0], kendo still group the number in group of 3 only: 1,000,000, while we expect the grouping to be 3 digits then separator then group of 2 digits etc.: 10,00,000.
Can anyone help me out on this?
Here is my code sample: http://dojo.telerik.com/#jayesh-jayakumar/AtojA/8
So the problem is you are using old KendoUI version without this feature implemented. Here is a snippet with newest kendo version and it looks that it behaves diffrent for en-IN: http://dojo.telerik.com/aqEwun
However I'm not sure if this is exacly how it works in this culture cause it creates only 2 groups of digits as you can see on my example (from decimal separator it is group of 2, group of 3 and rest of digits).
EDIT:
So as you mentioned you would like to have different behavior that this in example (starting from decimal point one group of 3 digits and then groups of 2). It seems it's a bug and maybe telerik will fix it one day. Until then, you can change groupSize value in culture object from [3, 2, 0] to [3, 2] to achieve what you want.
To fix it globally in all linked cultures you can use following code:
for(var i in kendo.cultures){
var culture = kendo.cultures[i];
if(JSON.stringify(culture.numberFormat.groupSize) === '[3,2,0]'){
culture.numberFormat.groupSize = [3, 2];
}
if(JSON.stringify(culture.numberFormat.currency.groupSize) === '[3,2,0]'){
culture.numberFormat.currency.groupSize = [3, 2];
}
if(JSON.stringify(culture.numberFormat.percent.groupSize) === '[3,2,0]'){
culture.numberFormat.percent.groupSize = [3, 2];
}
}
PS. You may consider use better array comparing function than JSON.stringify().
Updated snippet: http://dojo.telerik.com/aqEwun/3

Getting error while importing customers in Magento community

I am getting this error while importing customers in the community version of Magento. There is no such column like 'reward_update_notification' and 'reward_warning_notification'.
Required attribute 'reward_update_notification' has an empty value in rows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Required attribute 'reward_warning_notification' has an empty value in rows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Magento version is 1.9.0.1
Thanks
I do not know what is causing the problem. When you export new customers the column is there but the fields are empty.
Add the columns (with field names on line 1) and fill them with "1"
it works.
Erik

Qlikview, how to create an expression which does not change with listbox selection?

Example, I have table below..
Week, Quantity
1, 10
1, 15
1, 10
2, 20
2, 30
3, 10
3, 50
I also have a list box for 'Week' which is current selected on week 2.
Now, I want to create text object which shows the value of sum of quantity of week 1 (ie. 35), which will always show that result even when the list box is selected on week 2. How can I achieve this?
Currently I managed to do an expression which sums week 1 but as soon as I select week 2 it shows 0 ....
Enter the following to your textfield:
= 'Sum week 1 : ' & sum({$<Week={'1'}>}Quantity)
Use the '&' to concat values. And use the set analysis (Page 799 of the QlikView Reference Manual) to select the reqired values.
sum({$<Week={'1'}>}Quantity)
Read this like: Sum the values of 'Quantity' Where 'Week' is 1.
Replace the '$' with '1' and the expression will ignore current selection
e.g.
sum({1<Week={'1'}>}Quantity)
do this:
sum({<Week={'1'}>}Quantity)
That is basically telling Qlikview regardless of what is selected in Qlikview, that expression will always calculate as if Week 1 is selected.

Two (seemingly) identical queries, one is faster, why?

Two seemingly identical queries (as far as a newbie like me can tell, but the first is faster overall in the partial template rendering time (nothing else changed but the ids statement). Also, when testing through rails console, the latter will visibly run a query, the former will not. I do not understand why - and why the first statement is a few ms faster than the second - though I can guess it is due to the shorter method chaining to get the same result.
UPDATE: My bad. They are not running the same query, but it still is interesting how a select on all columns is faster than a select on one column. Maybe it is a negligible difference compared to the method chaining though.
ids = current_user.activities.map(&:person_id).reverse
SELECT "activities".* FROM "activities" WHERE "activities"."user_id" = 1
SELECT "people".* FROM "people" WHERE "people"."id" IN (1, 4, 12, 15, 3, 14, 17, 10, 5, 6) Rendered activities/_activities.html.haml (7.4ms)
ids = current_user.activities.order('id DESC').select{person_id}.map(&:person_id)
SELECT "activities"."person_id" FROM "activities" WHERE "activities"."user_id" = 1 ORDER BY id DESC
SELECT "people".* FROM "people" WHERE "people"."id" IN (1, 4, 12, 15, 3, 14, 17, 10, 5, 6) Rendered activities/_activities.html.haml (10.3ms)
The purpose of the statement is to retrieve the foreign key reference to people in the order in which they appeared in the activities table, (on its PK).
Note: I use Squeel for SQL.
In the first query, you've chained .map and .reverse, while in the second query, you've used .order('id DESC') .select(person_id) which were unnecessary, if you added .reverse

Resources