I am working in ssas on a Dimension Hierarchy.
Dimension:
Dim_Account
ID
Account_Code
Account_Desc
Account_Group_Code
Account_Group_Desc
Lets say there is 2 levels in the Hierarchy:
Account_Group_Code
Account_Code
I want the names that will be displayed to be the 'Code' followed by the 'Desc' (Description).
For example:
101-Group1
.....10111-Account1
.....10112-Account2
102-Group2
.....10211-Account3
.....10212-Account4
I can only change it to be either the code or the Description
For example:
101
.....10111
.....10112
or
Group2
.....Account3
.....Account4
What property can I used to accomplish this?
The easiest is to change your SQL view (or named query) on which your dimension is built. Add a field where you're concatenating your code and your description. Use this new field in your dimension.
Related
I have a cube with three (relevant) dimensions (quarter, element and qualifier). The measure of interest is score, which is numeric.
The qualifier dimension is sparse, i.e. for each unique combination of quarter and element, the measure score is reported only for one qualifier, for the other members of the qualifier dimension the measure score is blank. Which qualifier is 'active' entirely depends on the quarter and element.
I want to build a table with quarter members as columns and element members as rows. The cell values should be the concatenation of the score measure and the name of that qualifier member (string) for which the score at the relevant intersection of quarter, element and qualifier is not blank.
To make matters more complex, one of the member names of the qualifier needs to be replaced with blanks in the table. There are four distinct members, which should be renamed in the table as follows: the member names '+', '-', '' stay as they are, while the name 'No Qualifier' should become blank, i.e. ''.
Below is an example of the structure I would like to get (note that there should be no '+' or '-' in case the corresponding score is reported in either the qualifier members '' or 'No Qualifier'):
2021Q4
2020Q4
2019Q4
Element 1
3
2+
2
Element 2
1
1
1
Element 3
2
3
2+
Element 4
2-
2-
3
I suppose I would need to create a calculated member, but so far I only get the concatenation and replacement to work with the currentmember function if I include the qualifier dimension explicitly in either rows or columns, which however is not a feasible output structure. Also, changing the underlying cube is not possible (it is maintained by IT).
I am new to cubes and MDX and have already spent two days trying to figure this out by myself. Since this is a work project, I am starting to panic. Any help would really be appreciated!
I ran the following DMV query on SSAS.
SELECT
[HIERARCHY_UNIQUE_NAME],
[LEVEL_NAME],
[LEVEL_NUMBER],
[LEVEL_CARDINALITY],
[LEVEL_TYPE]
from $system.mdschema_levels
where [DIMENSION_UNIQUE_NAME] = '[DATE]'
AND [CUBE_NAME] = 'Adventure Works'
AND [LEVEL_NAME] <> '(All)'.
I get a lot of unexpected LEVEL_TYPES
I wanted to understand what do the LEVEL_TYPE like 4289, 4578, 4385, 4759 signify? Are they computed algorithmically or is they a documentation resource one can refer to?
These Level_TYPE are determined the "Type" property of the dimension attribute that you set in dimension design window of your SSAS project. In case if you set the Type to regular you get 0 else , if you select from one of the types present you get its identifier. The interesting bit is if the HIERARCHY_UNIQUE_NAME has a attribute hierarchy, it returns the identifier for the attribute hierarchy, if HIERARCHY_UNIQUE_NAME has user hierarchy, then the identifier is returned for the LEVEL_NAME's base attribute. For example in the result below, take a look at the two rows that return 68 in LEVEL_TYPE, the first row is being reported as attribute hierarchy, the second as user hierarchy's level(Notice the Level_Number 3 and the difference between the HIERARCHY_UNIQUE_NAME and LEVEL_NAME)
Edit: Specific type details
4289: type Date,
4578: type QuaterOfYear,
4385: type HalfYearOfYear,
4759: type WeekOfYear
I have the dimension 'Cities'.
Example:
'Paris'
'Moscow'
'London'
I need to create new Cities_Short_Name in mdx query where I can show first three letters. Examples: 'Par', 'Mos', 'Lon'. I can't change DSV on SSAS.
Your query will look something like the below. I made up the name of the dimension and the cube for this since you didn't specify anything other than that you have a dimension attribute called Cities.
with member [Measures].[Cities_Short_Name] as
left([Geography].[Cities].currentmember.name, 3)
select [Measures].[Cities_Short_Name]
on 0,
[Geography].[Cities].[Cities].members on 1
from [MyCube]
You will just need to replace the Geography dimension with whatever your dimension is called and MyCube with your cube name. This will return a list of cities and the associated abbreviation.
For example I want to filter my data based on next filter expression:
lead_veh_of_interest starts with 'BMW 1'
OR
sale_model starts with 'BMW 1'
how can I achieve this?
Are these fields both in the same table? If so you could create a calculated column that performs that conditional. Then filter the view on the resulting calculated column.
For example you could create the following calculated column.
Calculated Column: "Starts With BMW 1"
Equation:
=IF(OR(Left([lead_veh_of_interest starts], 5) = "BMW 1", Left([sale_Model], 5) = "BMW 1"), 1, 0)
Then in the view set the filter so that [Starts With BMW 1] = 1
I found acceptable solution (thanks for all suggestions - it was very helpful).
First of all I redesigned my model and (how #Mike_Honey suggsts me) created dedicated table with consolidated information I want to filter. Next I connected this new table with existing tables and created hierarchy from fields I want to give to the end users for step-wise filtering (previously I split down old fields contained information I want to filter into more granular level). Now it is possible to filter data by any combination of models in any combination of request types (sale, lead, competitor, etc) using hierarchy.
I have one fact table called "sales" - and two dimensions named "Year", "Type"
I want to disallow the user to browse the data by the "Year" dimension only,
because the aggregated sales by "Year" do not make sense.
Please show me a solution.
I guess a simple way would be to combine the two dimensions into one and implement a hierarchy
----- Type
-------- Year
Connect the sales to the above hierarchy and set the AttributHierarchyEnabled = False to each field of type and Year