Good Morning
How do I convert an cube in Analysis Services for csv or excel with command do sql server?
Good Morning
How do I convert an cube in Analysis Services for csv or excel with command do sql server?
Hello All,
I have been working to create a SSAS Cube with Time Intelligence Calculations like Year to Date, Quarter to Date etc. I have created the Time Dimension using the Dimension Wizard option "Generate a time table in the Data Source" and it created the Time table and populated it fine. The data shows up fine in the reports. Then I added a Time Intelligence using the "Add Business Intelligence" in the Cube and it created all the calculations (Year to Date, Month to Date etc.) fine. The Cube gets deployed successfully and says it got processed successfully. I have 2 issues.
1. The Time Intelligence Calculations just show NA in the Browse tab. Other Measures and Dimensions show the values fine.
2. I am trying to use this Cube for Performance Point in SharePoint 2013. The Time Calculations don't show up in Performance Point. Everything else works fine. The Hierarchy for Time Calculations shows up, but I am not able to use it or drag it into the Analytical Grid.
Can anyone help me with these issues? Thank you all in advance.
Thanks,
Bhuvan
valli
Hi,
I'm configuring access to a cube (SSAS) by executing a stored procedure that returns the items that each user has access. I'm doing this filter through filters data from a particular dimension, by running a method in a dll that returns an MDX expression with the particular filter for that user.
The problem I am having is that when the user has permissions to more than 50 items, only returns the first 50 returned by the stored procedure.
have someone solved something similar and know how to fix it? Do you know if the SET class has some limited on the number of tuples returned?
This is the Method i'm using:
public static Set FilterUNByUserName(string UserAccount) { Expression expr = new Expression(); SetBuilder sb = new SetBuilder(); using (SqlConnection cn = new SqlConnection()) { // prepare connection and command cn.ConnectionString = string.Format( "data source={0};initial catalog={1};integrated security={2};","server","ddbb","sspi" ); cn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandText = "[Seguridad].[FilterUNbyUser]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserAccount", UserAccount); // execute stored procedure SqlDataReader r = cmd.ExecuteReader(CommandBehavior.SingleResult); bool hasRow = r.Read(); // iterate through the result set while (true == hasRow) { // add each member key to MDX set expr.ExpressionText = string.Format("[BI UNIT].[UN Id].&[{0}]", r[0].ToString()); Member m = expr.CalculateMdxObject(null).ToMember(); TupleBuilder tb = new TupleBuilder(); tb.Add(m); sb.Add(tb.ToTuple()); hasRow = r.Read(); } cn.Close(); // return MDX set return sb.ToSet(); } }
Thank you very much
Regards
Eduardo
Hello dears,
I want to display my problem. I have a cube that connected to hive DB through views. There are some changes that apply to some related tables on hive. This changes reflect on the cube so i make full process for the cube. I want to process only partitions that have been changed without full process. I detect changes on this table on another table on the local database.
So can anyone help me to fix these issues?
Thanks in advance.
Hi -- I have a time dimension which has Date, Week, Month and Year. However, the hierarchy will have only Week, Month and Year. It works great for any Sales measure with AggregateFunction as SUM.
I have created a new measure with AggregateFunction = LastNonEmpty. Also in the backend, I have pushed all the inventory data to last date in every month as inventory is always looked on a monthly basis not on a weekly basis. This measure shows correct data for every last week of the month in the hierarchy. However, Months and Years are displayed as zeros.
Really appreciate if someone can help what I am doing wrong. Thanks
Krish
*All simplified example data below of course
Using SSAS Tabular I have an issue where I get a "cross join" result when I try to display a Person's (one person ever unique) tied to their employee record (person can have multiple) to their job position records (again multiple).
It seems like there should be a way to do this so that the end user does not need to decide which measure to pick to tie together the tables.
Table structure with data:
*Each table has a calculated column of *Tally which is just =1. Just used it for SUM, could have also used DISTINCTCOUNT I imagine, either would have been fine most likely.
https://social.msdn.microsoft.com/Forums/getfile/665140
If the end user only wants to view a listing of Persons it works great, but our users may want to see the counts of all 3 (how many unique Persons (which will always be 1 per Person record) to how many employee records that person has to how many Positions that person (or employee record) has had.
How can I set this up so that they can drag any measure and have it filter appropriately and not "cross join" out the child tables?
https://social.msdn.microsoft.com/Forums/getfile/665143
How do I properly adjust my measure to handle this?
Note the red is where the rows ACTUALLY intersect, the rest of course are cross join or Cartesian products due to my Person measure always returning 1 and my employee measure always returning it's value and not filtering out on Position measure being blank/NULL.
I'm quite new at Analysis Services and I need a calculated measure that counts the amount of worked days per month.
Here's what I've made:
WITH MEMBER MEASURES.[Worked days] AS 'IIF( IsEmpty([Measures].[Session Count]) or [Measures].[Session Count] = 0, null, distinctcount([TimeDim].[Complete date].members) )' SELECT [User].[User].members ON 1, { [Measures].[Worked days], [Measures].[Updates] } on 0 FROM"Usage Cube" WHERE [TimeDim].[Month].[November]
The problem with the new measure is that the where clause isn't making any effect on it. It's returning the amount of worked days in the whole database instead of just in the given month. What am I missing here?
Thanks in advance.
Distinct count is repeating the value for dimension attribute/member used to calculate distinct count
so i am calculating distinct count as
CREATE MEMBER CURRENTCUBE.[Measures].[# of Projects]and when i try to analyze this count in excel and put project id on rows to slice the data, it shows the total value for all project ids instead of showing 1 for each. how can i fix it?
Hi all,
I'm implementing prior period and prior corresponding period time intelligence in a cube.
I've been perusing a very handy blog here: http://sqlmag.com/sql-server-analysis-services/optimizing-time-based-calculations-ssas
I've implemented the hierarchy based mdx to get my attributes that belong to my fiscal and calendar hierarchies working..
But i'm wondering if there's a shorthand 'catchall' scope that will cover the 'prior period' functionality for every attribute?
Jakub @ Melbourne, Australia Blog
I have a fact table that has 1 row for each person, their employee record, and their job position record.
1 Employee with a unique ID (like SSN but not called PersonID), Their employee record which is when they started left (could be multiple someone could start, work for 3 years, leave, come back 5 years later, get a new employee record), and their job record (worked for 3 years, promoted 5 times so 1 record per job/promotion):
Here is what I mean by adding the dimension and it "cross joining" it out.
*Direct link to that image for larger viewing:
https://social.msdn.microsoft.com/Forums/getfile/663921
It appears to be due to my using ALLEXCEPT as those measures do have data that returns so the relationship seems to pull back data, so I realize I need to adjust my ALLEXCEPT measures, but I'm not sure how to accomplish that exactly.
My Measures:
DistinctPerson:=DISTINCTCOUNT([PersonID])
EmployeeRecordsForPerson:=CALCULATE(DISTINCTCOUNT([EmployeeRecordID]),ALLEXCEPT('EmployeePositions','EmployeePositions'[PersonID]))
EmployeeRecords:=DISTINCTCOUNT([EmployeeRecordID])
PositionsForPerson:=CALCULATE(DISTINCTCOUNT([PositionID]),ALLEXCEPT('EmployeePositions',EmployeePositions[EmployeeRecordID],EmployeePositions[PersonID]))
Positions:=DISTINCTCOUNT([PositionID])
Example below of the EmployeePositions "fact" table and the Position lookup dimension:
*All fake simplified data of course
*PositionRecordTally should be ignored, was just messing with it.
EDIT:
I can work around this by checking IF ISBLANK([EmployeeRecords]),BLANK(),putMyMeasureHere)
However, doing that feels like a bad kludge and like I'm just skirting the issue instead of fixing the real problem which is my usage of ALLEXCEPT.
Hi,
I am recently encountering proble with SSAS cube,In a day cube is going to offline for several time and unable to browse it and after some time automatically cube is getting online.I am unable to figure it out what is happening.
FYIP..For every 15 Min cube will be Proccessed Full.
Regards,
Ram
Hi All,
I have number of users which are under 6 Groups. We have 4 drill through actions. Now I would like to restrict 2 drill through actions for only some groups.
Can you please help on this.
Thanks and Regards Rajesh
I have a stored proc to extract data from the Calendar table and creates a cube for SQL server analysis services.
It is something like
SELECT Calendar_Date as ForwardDate,
......
Calendar_Year AS [Calendar Year]
FROM dbo.Calendar
The Calendar_Date is a primary key field and its type is datetime.
So there is no empty value nor invalid date in this field.
The stored procedure has no empty row. However, when I created a cube using the stored proc, it added an empty row. No matter how I limit the dates, the cube still adds an empty row.
I have another stored proc to create another cube. It accesses the same table, Calendar and this one does not add an empty row.
How can I prevent the former cube from adding an empty row?
I have a tabular cube and whenever I deploy it from SSDT, it overwrites all the roles & memberships. Is there any way to prevent this? Thanks. -Brian |
Once we create thee cube calculations in the "Calculations" tab in SSAS cube, how it get executed for the below scenarios.
If my cube has 3 Calculations and i am running a mdx which includes 1 out of these 3 calculations. Will it still execute/calculate all the 3 calculations or only the related one calculation will be executed.
I'm trying to set up time intelligence in a cube using the 'calculated member' approach. The blog I'm using is - http://sqlmag.com/sql-server-analysis-services/optimizing-time-based-calculations-ssas
The problem I have relates to my scoped prior period and previous year measures not working when more than one date attribute is selected.
I've hacked together some working approaches but after advice on which is best practise and any issues/consequences of using the methods i've outlined. The data is loosely based on adventureworks
My simplified date dim has the following data
DateKey | FullDateAlternateKey | FullDateName | FiscalMonthKey | FiscalMonthName | FiscalShortMonthName | FiscalYearName |
20050101 | 2005-01-01 | Jan 1, 2005 | 200507 | January | Jan 2004-05 | 2004-05 |
20050102 | 2005-01-02 | Jan 2, 2005 | 200507 | January | Jan 2004-05 | 2004-05 |
20050103 | 2005-01-03 | Jan 3, 2005 | 200507 | January | Jan 2004-05 | 2004-05 |
20050104 | 2005-01-04 | Jan 4, 2005 | 200507 | January | Jan 2004-05 | 2004-05 |
20050105 | 2005-01-05 | Jan 5, 2005 | 200507 | January | Jan 2004-05 | 2004-05 |
20050106 | 2005-01-06 | Jan 6, 2005 | 200507 | January | Jan 2004-05 | 2004-05 |
My date dim is set up as such
Attribute | Key | Name | Value | Type |
Date | DateKey | FullDateName | FullDateAlternateKey | Date |
Fiscal Month | FiscalMonthKey | FiscalMonthName | FiscalMonthName | FiscalMonths |
Fiscal Month Year | FiscalMonthKey | FiscalShortMonthName | FiscalShortMonthName | FiscalMonths |
Fiscal Year Name | Fiscal Year Name | FiscalYears |
The fiscal months are using the same key because one of the objectives i have is to have multiple 'labels' for the same physical object
Other examples could be needing to show financial year as both FY 2005-06 and/or 2006 or something.
And my MDX is
CREATE MEMBER CURRENTCUBE.[Dim Date Calculations].[Date Calculations].[PriorPeriod] AS Null, VISIBLE = 1; CREATE MEMBER CURRENTCUBE.[Dim Date Calculations].[Date Calculations].[YearAgo] AS Null, VISIBLE = 1; Scope( [Dim Date].[Fiscal Month].[Fiscal Month].Members ); -- Prior Period ( ( [Dim Date Calculations].[Date Calculations].[PriorPeriod] ) = ( [Dim Date].[Fiscal Month].CurrentMember.PrevMember ,[Dim Date Calculations].[Date Calculations].[Current] ) ); -- Year Ago ( ( [Dim Date Calculations].[Date Calculations].[YearAgo] ) = ( [Dim Date].[Fiscal Month].CurrentMember.Lag(12) ,[Dim Date Calculations].[Date Calculations].[Current] ) ); End Scope; Scope( [Dim Date].[Fiscal Month Year].[Fiscal Month Year].Members ); -- Prior Period ( ( [Dim Date Calculations].[Date Calculations].[PriorPeriod] ) = ( [Dim Date].[Fiscal Month Year].CurrentMember.PrevMember ,[Dim Date Calculations].[Date Calculations].[Current] ) ); -- Year Ago ( ( [Dim Date Calculations].[Date Calculations].[YearAgo] ) = ( [Dim Date].[Fiscal Month Year].CurrentMember.Lag(12) ,[Dim Date Calculations].[Date Calculations].[Current] ) ); End Scope; -- Fiscal Year Name Scope( [Dim Date].[Fiscal Year Name].[Fiscal Year Name]); -- Prior Period ( [Dim Date Calculations].[Date Calculations].[PriorPeriod] = ( [Dim Date].[Fiscal Year Name].CurrentMember.PrevMember ,[Dim Date Calculations].[Date Calculations].[Current] ) ); -- Year Ago. Exclude for attributes that have no concept of prior year ( [Dim Date Calculations].[Date Calculations].[YearAgo] = ( [Dim Date].[Fiscal Year Name].CurrentMember.Lag(1) ,[Dim Date Calculations].[Date Calculations].[Current] ) ); End Scope;
This works if i only add one of the dimensions to my dataset that shows current, prior period and year ago for an order qty measure
But if i have Fiscal Month and Year, then the year ago calc goes blank (as expected, there's no relationship defined)
It works for fiscal month and fiscal year name if I define the attribute relationship as "Date -> Fiscal Month -> Fiscal Year Name".
But adding Fiscal Month Year reverts to the previous incorrect behaviour. Removing the Fiscal Year Name will cause Fiscal Month Year to show both Prior Period and YearAgo correctly.
Now, i can get it working by modifying the relationship in one of two ways.. adding 1:1 relationships to the attribute relationship so it becomes
Date -> Fiscal Month -(1:1)> Fiscal Month Year -> Fiscal Year Name
Or the other way, which is the more visually accurate way where both fiscal month and fiscal month year go up to fiscal year name, but this requires that I create two user defined hierarchies to have it work correctly and get rid of the "multiple incoming relationships" warning shown below (I plan on creating some user defined hierarchies, but don't want to be forced to complicate the end user experience by creating hierarchies specifically for MDX to work if i can avoid it)
So which of the above two ways is "better" in terms of query execution speed and functionality (eg will work with more combinations)?
Or is there another way?
Disclaimer:
Most of this code is copy-pasted and interfered with until the output looks right for my data. Any suggestions for improvement as more than welcome
I've been involved in a few SSAS across the versions over the years, but the times between mean I completely forget everything and need to start fresh each time :(
Jakub @ Melbourne, Australia Blog
On a German SSAS the following MDX query returns an error (wrong syntax for ','). Obviously, there is a problem with the decimal separator, as the code works with "Days to Manufacture" (integer) instead of "List Price". Of course, I could use the Val function instead of the StrToValue function in this case. But maybe there is a setting to avoid this "bug"?
WITH MEMBER [Measures].[Avg List Price] AS Avg ( Descendants ( [Product].[Product Categories].CurrentMember ,[Product].[Product Categories].[Product] ) AS Set1 ,StrToValue(Set1.Current.Properties("List Price")) ) ,Format_String = "Currency" SELECT {[Measures].[Avg List Price]} ON 0 ,{[Product].[Product Categories].[Category]} ON 1 FROM [Adventure Works];