How can I get the format string for a currency value in analysis services?
When I run an MDX query to retrieve a measure with a type of Currency, the value is returned in the expected format e.g. €1.000,00. This is correct as my Cube's locale is set up to be Ireland.
Is there anyway for me to retrieve the currency format string?
So, for my Cube with it's locale set to Ireland, the currency format string would be something like "€#.###,##"
Is there a way that I can retrieve this information from Analysis Services?
I can run the following DMX query to get information about the measures and their formats, but this only shows the format as Currency for my currency measures:
select
MEASURE_UNIQUE_NAME,
MEASURE_NAME,
DEFAULT_FORMAT_STRING
from
$system.MDSCHEMA_MEASURES
Any ideas?
Be careful with using "Currency" as your format string. You don't want someone from Mexico to connect and suddenly see a different currency symbol without actual conversion to Pesos.
http://blog.crossjoin.co.uk/2008/04/24/currency-formats-should-they-be-tied-to-language/
I would hardcode the FORMAT_STRING to "€#.###,##" unless you are actually converting currencies dynamically inside the cube.
If you want to retrieve the format string for a cell you can:
SELECT [Measures].[Your Measures] on COLUMNS
from [Your Cube]
CELL PROPERTIES FORMATTED_VALUE, VALUE, FORMAT_STRING
That query retrieves one cell and 3 properties. The FORMATTED_VALUE property takes the numeric value and applies the format string and returns €1.000,00. The value is just the number without any formatting like 1000. The FORMAT_STRING will be "€#.###,##".
Related
I made a simple query function as this: =QUERY(range,"select *",1), in my Google Spreadsheet, but the results dose not show any letters, it shows only fields that contains numbers.
Study this link
Syntax
QUERY(data, query, [headers])
data - The range of cells to perform the query on.
Each column of data can only hold boolean, numeric (including
date/time types) or string values.
In case of mixed data types in a single column, the majority data type
determines the data type of the column for query purposes. Minority
data types are considered null values.
Just format your range as a plain text using Format > Number > Plain text option, the below images show how to do it:
I have infragistics2 v10.3.
I have ultra grid with two columns
|String|DateTime|
For DateTime I have custom formatting like "dd.MM.yyyy HH:mm" System Regional settings have short Date format like "dd-MMM-yy".
So grid shows 07.02.2013 14:00 and user See this.
The sytem have 07-Feb-13
When i want to filter all columns with text "fe" it is also shows me all rows which contains 07.02.2013.
During filtering it uses own formating and ignores my custom In InitializeLayout event we have done the following code to set date format for the StartDate column
e.Layout.Bands(0).Columns("StartDate").Style = Win.UltraWinGrid.ColumnStyle.Date
e.Layout.Bands(0).Columns("StartDate").Format = "dd/MM/yyyy"
e.Layout.Bands(0).Columns("StartDate").ButtonDisplayStyle = UltraWinGrid.ButtonDisplayStyle.Always
This date field column filter displaying based on Local system date format in opened calendar.
Please suggest me where I am doing wrong
As your are using string column type to store dates, I suspect how the dates are converted: 07/08/2015 is treated as August 7 or July 8?
You are setting the format for your grid but the data loaded in the DropDown may be in its original form as in the Database.
If you do not want to change the data type of your date column, I would advise that you set DateFormat within the select query as demonstrated in change-data-type-of-data-retrieved-by-select-query (but beware of the conversion errors or the date change scenario as pointed above)
If you are using SQL Server (I'm not sure about other databases) you can use a UDF (User Defined Function) in the select query as in this example of UDF on TechNet or this post on SO: using-udf-in-select-statement
Along with that don't forget to set the Format of your DropDown, if defined explicitly on initialize or on entering edit mode.
You need to set MaskInput property of the column like this:
e.Layout.Bands(0).Columns("StartDate").MaskInput = "dd/mm/yyyy";
Keep in mind when cell is in edit mode it uses an editor to display the edited value. So when you need to fix anything in edit mode you need to fix it in the editor.
I have a SQL Server Analysis Service OLAP cube where one of the dimension fields, is a datetime field. This is not a Date Dimension (Like the ones that can be generated.). This represents a month end period for the data. It can be filtered for example to see the end of year 2013.
The problem is the sql server data field is a datetime field, other than changing the type to just date, how can I change the format to exclude the time? Basically; MM/DD/YYYY.
Measures seem to have the ability to be formatted (Currency for example), but not Dimensions.
I looked at the view, but there's not formatting options their either. Maybe I need to look at the view code and add sql formatting code there?
Excel: I can't change the format on the cells in Excel either.
Try to format the Dimension Attribute field in your view first. Example:
FORMAT(hub.DateAlternateKey,'MM/dd/yyyy','en-US') AS DateAlternateKey
Then you should go under attribute properties of your Date Dimension's Day Attribute and set NameColumn=DateAlternateKey. This attribute should be set to Type=Date.
This may be very basic. I'm trying to change the format string used on a measure based on the attribute of a dimension connected to the measure. I'm doing this in a calculated measure at the moment.
Essentially, the fact table row contains a value for the ID of the dimension, and that dimension has the format information I want. I'd like to apply formatting based on that value, without the dimension being required in my query.
something like this:
WHEN [Format Source].[Hierarchy].CurrentMember.Properties("Format") is [Format Source].[Format].&[Number (123)]
THEN FORMAT([Measures].[Volume], "#.#")
I'd like this formatting to be applied regardless of having the dimension in the query, as I won't always have control over how the reports the users create. The data could be whole number or % with differing levels of decimal precision, based on the attribute of the format dimension.
I think that I may just be way off on this one, thanks in advance for any help
I have a date dimension I want to filter on. I use MDX Range (:) operator for that. The problem is it appears that range bounds must be valid members of a set. I have IntDate attribute in my Date dimension, and it's an integer in the YYYYMMDD format. When I browse the dimension, there are 20120705 and 20120706 values, but not 20120704 or 20120707. Still, as far as range is concerned, both 20120705:20120706 and 20120704:20120707 encompass 20120705 and 20120706 and I hoped would return 20120705 and 20120706. But when first one works as expected, second returns empty set. The reason I need loose range to work is that users may enter date range that is not based on data in the dimension. How can I make this work?
The one that works:
The one that returns empty set.
Thank you,
Vlad.
Since your 20130707 member doesn't exist, the cube can't know where it was supposed to go.
It seems odd that you have a date dimension that doesn't contain all of the days in a month. I would suggest repopulating your date dimension so that it has all dates. You can get a fully populated date dimension from the Azure data market if you are using a tabular cube. If you are using multidimensional, you can have SSAS generate one for you. If you have parameters built off of dates, you can limit the list to populate them to show only the data for which there are measures using Exists.
I also wonder why you want users to enter dates rather than choose dates from a valid list. How do you handle the errors when they enter a value that is simply invalid? It seems the easiest/safest choice is to give them the list of dates from which to choose. If they are entering things that don't have data and you have error handling, the result should be the same as if they choose from a valid list.
That being said, you should be able to so something like the below. I check to see if the date is a valid member. If it isn't I substitute the first valid member I find in the list of members (you could choose your own date and insert it there). For the end of the range, I find the last valid member (again, you can substitute your own value).
{Iif(Count(Exists([Date].[Int Date].members, [Date].[Int Date].[20130704]))>0,[Date].[Int Date].[20130704], [Date].[Int Date].firstchild):
Iif(Count(Exists([Date].[Int Date].members, [Date].[Int Date].[20130707]))>0,[Date].[Int Date].[20130707], [Date].[Int Date].lastchild)}