SSRS 2012 Expression builder Today() error - visual-studio-2012

I have two SSRS Parameters, Date/Time type: BeginDate and EndDate. I want them to default to EndDate=Today() and BeginDate=Today()-six months. Using Report Parameters, Default Values, I add a value and create the function =Today() but I get the red squiggly line under the parens.
If I select the function from the Category list and double click it into the "Set Expression for:Value" box, I get the function with a single open-paren and the red squiggly which remains if I close off with a close-paren.
I get the same error if (following the example in the "Example" section, for crist's sake) of =DateAdd("m", -6, Today()) I get the same error instead of a date six months prior.
A little help please...?
Thanks

The problem is that you are using SQL command syntax but Reporting Services uses VBA.
Even though the examples show Today() with the brackets after it, as if it was a method, that actually displays as a syntax error for me in the expression editor. Today's date is simply accessed like a property:
=Today
DateAdd exists but uses DateInterval properties, not the SQL "m" so six months ago is:
=DateAdd(DateInterval.Month, -6, Today)

Related

Power Automate - Compare StartDate to current date?

We are looking to compare the calendar start date with the current date in flow. Currently we are pulling the start date through a filter query like this:
formatDateTime('EventDate','M-d-yyy hh:mm')
and comparing to this:
formatDateTime(addDays(utcNow(),3),'M-d-yyyy hh:mm')
I am getting this error currently: "Unable to process template language expressions in action 'Get_items' inputs at line '1' and column '17987': 'In function 'formatDateTime', the value provided for date time string 'EventDate' was not valid. The datetime string must match ISO 8601 format."
Any help on this would be greatly appreciated!
You could Initialize a variable like the following below and then do a IF condition.
#{add(div(sub(ticks(utcNow()),ticks('1900-01-01')),864000000000),2)}
I test with the same formula to convert event start date and it works fine in my end. The if condition returns correct result on different conditions.
Here is the logic of my demo flow, please have a check:
I use get item to get the start date of a certain event in the calendar list and convert the start time dynamic content to the format I need. Almost same with yours.
According to the error message, it seems the format of the event date column is not in the supported format. Would you like to provide the settings of your event date column? I test with the default start time column and a custom date & time column of default settings. Both of them works fine with the flow above.
Update:
The two formulas used are displayed below:
formatDateTime(outputs('Get_item')?['body/Event_x0020_Date'],'M-d-yyy hh:mm')
formatDateTime(addDays(utcNow(),3),'M-d-yyyy hh:mm')
I just directly use the outputs of the data compose action in the if condition
What worked for me was to build a sequence of numbers with the dates being ordered by day, month and year this way, when converting to integer, it's easy to compare
int(formatDateTime(utcNow()),'yyyyMMdd'))
if you need add day for exemple, you can use
int(formatDateTime(addDays(utcNow(),variables('extraDays')),'yyyyMMdd'))
and the other date like this
int(formatDateTime(variables('FinalDate'),'yyyyMMdd'))
Based on your example, you can put hours and minutes without any problems, just remove the special characters and spaces
but by the definition of the error you are having, I believe it is because of the way you are writing the variable

Changing portlet item color scheme based off of date

I am trying to change the colors of lines displayed in my portlet based off of a date range. The following are examples of what I am trying to do.
within the last 7 days - green
greater than 7 days - red.
I have tried the following expressions :date - 7 and it does not work, I am assuming as there is not an overloaded operator to handle the subtraction between a date object and a integer. Also for the expression field, can it handle function calls? As I have also tried to use getdate() which does not work here.
Assuming you are talking about a ResultSet portlet on a Start Center, date math has historically been abysmal in this context. You would be better to write an Automation Script to support a new Function and then call your Function from an Attribute Formula. You can then do your color coded rows against the integer attribute you associated to the Formula.
The only thing I found lacking in the relevant Help and product documentation was that your script needs to return its calculation result in a variable called retval or whatever it is for Custom Condition launch points.

Excel bug: TEXT function doesn't work to extract day name depending on region

How to compute day name from date in Excel?
Please don't say it is TEXT(...,"ddd") because it doesn't work
Another screenshots for non-believers:
Complete formula just doesn't work too:
This is some problem with locale processing. Although my Windows in English, my region is Russia and Excel uses it in some strange places:
TEXT(...,"ddd") ( or TEXT(...;"ddd") . as required )
does work, provided you either SUBSTITUTE the dots . in your data for recognisable date separators first (eg /) or apply Find/Replace for that purpose. Though having done either (perhaps working on a copy) no formula is necessary since merely a Custom format of:
dddd
(long form, or ddd short) should be sufficient.
Note that without indication of the century Excel will guess which and not give you the right answer for a date such as 11.11.1911 (Armistice Day, a Saturday) represented in text as 11.11.11.
With string parsing you would need to be careful whether 10.08 represents October 8 on your system, or August 10.
We can always manually build one : =if(WEEKDAY(A1,2)=7,"Sunday",if(WEEKDAY(A1,2)=6,"Saturday",if(WEEKDAY(A1,2)=5,"Friday",if(WEEKDAY(A1,2)=4,"Thursday",if(WEEKDAY(A1,2)=3,"Wednesday",if(WEEKDAY(A1,2)=2,"Tuesday",if(WEEKDAY(A1,2)=1,"Monday","")))))))
[^_^]

Can't convert Date to Number

I have a userform and I take start and end dates from user as in dd.mm.yyyy format. To make it easier to compare dates, I want to turn it to a double or long type of value. I have tried as in below but it gives me an error of type mismatch.
endDate is already defined as Double and as you can see, Me.g_end.Value is string in proper format. Why do I get this error, and how can I handle it?
Also I need to add, DateValue(Me.g_end.Value) works fine with my friend to get value of date who uses Excel 2013. I use Excel 2016.
You need to enter dates in a valid format in order for Excel to recognize them as dates.
As far as I know, nowhere uses dots (periods) in dates. (As I recall, nowadays only one country in the world even recognizes dots as am official date separator.)
Click your Start menu and type Region to find and open Windows Region and Language Settings.
Note the format that your system is expecting for Short Date, including the symbol between each date part, and try entering your dates in Excel like that.

Creating Custom Date Function in Excel

I am trying to code a date function in Excel using the Month and than the last two digits of the year. So for example I just have the numbers 1-12 in a column. Then I want to code them as follows. 1 is Jan-15, 2 is Feb-15,..June-15. Then 7 is July-14, 8 is Aug-14. However whenever I try to type in those it codes them as their respective month, the day and the year as 2015. I know I have to create a custom format date function, but how would I go about doing that in this case. I have seen some things, but many of times it is unclear. Could Someone help me out.
This link can help you out.
Create a custom date format
If you want to use a format that isn’t in the Type box, you can create your own. The easiest way to do this is to start from a format this is close to what you want.
Select the cells you want to format.
Press CTRL+1.
In the Format Cells box, click the Number tab.
In the Category list, click Date, and then under Type, pick a date format that is close to the format you want.
Go back to the Category list, and pick Custom. Under Type, you’ll see the format code for the date format you picked in step 4. The built-in date format can’t be changed, so don’t worry about messing it up. The changes you make will only apply to the custom format you’re creating.
In the Type box, make the changes you want using code from the table below.
According to the table there and your description I suppose you should use a custom format like:
mmm-yy

Resources