Format Code for Currency Microsoft Chart SSRS - reporting-services

Working on an SSRS in BIDS 2005 and I'm creating a chart that shows money values, in USD. How can I format using the Format code?

Normally the report server uses the format that it has for its regional settings but you can change this to use the user's regional settings.
On the report properties, in the Language property set it to:
=User!Language
Then use the international formatting codes throughout your report. In your example, C2 will give you the appropriate currency format (usually with a leading dollar sign, commas, and two decimal places) in the way the user expects to see it. Other examples are:
N0 Number with commas and no decimal places
P1 Percentage with one decimal place
d Short date format

If you use [Currency] as the format code, you should have the data displayed with the currency sign of the current locale (which is USD, assuming the user runs this on a computer with US locale).
Thea above did not work. The solution - according to the comment - was to use $#.00 as the format string.

Related

pyodbc returns extra decimal places for MS Access Double/Single fields

When I'm fetching data from my access database with pyodbc, it returns false format for float, date, or integers.
For example:
These values
Are returned like this
I've been searching for a long time now, I think it comes from the ODBC Driver used, but realy, I have no clue.
Another example would be a date like "21/01/2021" of type DATE in my MS Access DB, will be returned as a datetime in chinese or korean format YYYY-mm-dd H:m:s.
Floating-point columns (Numeric(Double) and Numeric(Single)) will display all decimal places in the Access UI if the field definitions in the table use the default formatting options
Format: (empty)
Decimal Places: Auto
Changing those settings to
Format: Fixed
Decimal Places: 2
will change the display format in the Access UI but the number itself will still be stored with its full precision. The ODBC driver does not pay attention to those formatting properties, so it returns the values with all available decimal places.
As for Date/Time values, the default format in the Access UI is to display just the date if the time component is exactly midnight. However the Date/Time value is stored with that time component (00:00:00) and again, the ODBC driver returns the complete value. See this answer for a more detailed explanation.

Changing the SSRS date picker format to DD/MM/YYYY

I have seen this issue posted a few times but there does not appear to be a solution for what I am seeing. I have a paginated SSRS report that requires a date input from the drop-down calendar. Upon entering, say, January 21st 2020, the UI is then displaying the date chosen as 1/21/2020, for example here. I need it to be 21/01/2020. Some points of note:
* all location settings for both the report server and the client browser are set to English (United Kingdom) and all date format settings are set to dd/mm/yyyy within the Windows settings on both the report server and client machine. All client browser language settings are English-UK in both IE and Chrome
* the variable is a DateTime data type
* this is a paginated SSRS report being displayed on a Power BI host server
* this is affecting all reports on this server
* the date field is not necessarily returned in the report, so converting the data is not applicable here.
* PBI version 15, SQL Server 2016
I have seen responses talking about expressing the field into the correct format, eg =CDate(Fields!BirthDate.Value) or =FormatDateTime(Fields!BirthDate.Value, DateFormat.ShortDate) however this does not appear to change anything (when it doesn't error).
I'm at a total loss as to where this Americanization of the date is coming from. Any thoughts?
Unfortunately, the report server's location settings and the user's browser's location settings don't (by default) do anything to the report formats because the report has its own Language property that is set by default to en-US. So unless you modify this property, you are always going to get US formats. You access this property on the report's Property panel.
Now you could set it to en-UK but a better solution is to set it to the user's internationali[s|z]ation setting by using =User!Language. Now you can use d as the cell Format property for the user's regional short date format.
Handy formats that use the user's regional formats are:
d = short date format
N2 = number with 2 decimal places
N0 = number with no decimal places
P0 = percent with no decimal places

Format a column with percentage using VBA

I am exporting a report to Excel from Access through VBA. There is a column in the report that should be formatted as percentage and round. How can I format this?
Set the Format property of the textbox in the report to: Percent
You may have to divide the value by 100 first. If so, rename the textbox to anything else than the name of the field, and use this expression as ControlSource:
=[YourFieldName]/100
For a new formatted string value, use Format:
=Format([YourFieldName],"Percent")
You don't mention what kind of rounding you need, but functions for all general methods of rounding are listed here: Rounding values up, down, by 4/5, or to significant figures

SSRS 2008 date formatting and exporting to excel confusion

Suppose I have a field with a date value in a Reporting Services template, e.g. =CDate("2010.12.03"), I apply the "d" format to this cell, which, according to the description, "will reflect the regional settings of the report". I generate the report using the English language, the date is displayed as 12/03/2010, which is fine. Now when I export this report to excel, I have no idea what the __ happens.
First scenario: the regional settings of the computer are set to English (United States). When I open the excel document, the value seen in the cell is 12/03/2010, as expected. When I click on it, I can see that the actual value stored in the cell is 2010.12.03, which also seems reasonable - some formatting is applied to the cell, it's not simply exported as text. But when I try to figure out what type of formatting is applied, by right clicking and checking Format Cells, I see that the format is "General", i.e. none! How can this be ? This is Excel 2010 by the way, but the file itself is .xls, of course.
Second scenario, where it gets more interesting: now the region of the computer is set to e.g. Lithuania, where the date format is 2010.12.03. I open the same document and see 12.03.2010. Now that simply does not make any sense. Exporting many times I've encountered that sometimes the cell is formatted as [$-10409]m.d.yyyy in excel (under the Custom section). What is this, what does the 10409 mean ? The weirdest part of all: if I close the document without saving, change the computer region back to English (United States), reopen the document, the format is now [$-10409]m/d/yyyy ! HOW is this possible !??
Basically the same thing happens with numbers and with thousand/decimal separators - excel uses the region of the computer to format these, but the actual format of the cell can be something like [$-10409]#,##0.00;-#,##0.00 or General - again, depending on the region of the computer, direction of wind and the temperature outside.
My question is then, first of all, what the __ is going on ? Second, how should the excel document behave according to the specs, i.e. what does the statement that a format "will reflect the regional settings of the report" in the BIDS designed, where I chose the "d" format for the date textbox, mean ? Does it mean, that the format will be determined by the language of the report and the result will look the same on all computers in the world (which makes sense, since this is how other formats behave, i.e. if you export the date to a pdf, it stays the same always) ? If not, which appears to be partially the case in excel, why doesn't the exported date cell have the regional date format, i.e. the one that you normally use in excel, the one which formats the date according to the region of the computer ?
Are these some kind of limitations of excel or what ? Why can't we have consistent behavior, i.e. either make everything sensitive to the culture of the computer viewing the document or don't, why is the actual behavior somewhere in between ?
Excel uses a custom encoding for the date, and uses the machine regional settings as a hint on how to format the contents. The encoding is archaic, and has lots of specific, historic gotchas.
This means that the kinds of bugs that you see often do happen - you'll have data that's been exported to Excel, which then has its formatting and contents mangled once opened for the first time by the actual Excel application. The problem can be anywhere along the line - maybe the library that exports the data to Excel doesn't deal with some of the more esoteric historic cases well, or maybe Excel is confusing itself along the way.
I've had some success in the past with exporting dates as a strings to a CSV file, stripped of formatting, and then importing them into Excel/opening them with Excel.
I sorted my date formatting problem by:
adding calculated fields for the dates :
=IIF(IsNothing(Fields!Date_Delivery_Confirmed.Value),nothing,DateSerial(DatePart("yyyy",Fields!Date_Delivery_Confirmed.Value), DatePart("m",Fields!Date_Delivery_Confirmed.Value),DatePart("d",Fields!Date_Delivery_Confirmed.Value)))
set cell Textbox as dateformat
how I am using *dateformats (localised) I checked my server laptop and report are set to the right language
I have aligned elements vertically in the report so it ( the visual gaps) doesn't create extra empty columns when exporting to excel. Because 2 excel columns merged to 1 date-cell will never get any format but "General format"

MS Access, number formatting

I need to display a number (real), ie 1234.567 like "1.234,56" or "1,234.56". I know that I have to use Format() but I can't figure it out. (It's for a textbox where the 'Control Source' property is set to some number field)
This should do it:
Format(number, "#,##0.00")
Where the actual separators used depend on the current locale setting.
Below method worked for me in ms access 2000-2003.
You should make changed in Table and in reports.
Table.
Go to the required field, Change data type to Nnmber, Field size to Decimal, Format to Standard.
Report.
Select the control where you want the thousand separator, select properties the format Select standard,, Decimal places 2.