Quantcast
Channel: SQL Server Analysis Services forum
Viewing all 14337 articles
Browse latest View live

using sql server 2016 temporal tables as SCD2 dimensions in SSAS models

$
0
0

So...

While 2016 temporal tables makes a lot of sense in an OLTP environment, where we also write reporting queries 

our selves - for example the following join between  facts (F) and temporal SCD2 table of Product dimension (P):

ON P.ProductId = F.ProductId  AND F.FactDate BETWEEN P.ValidFrom AND P.ValidTo 

I wonder if this is relevant at all to power bi or SSAS models  

where join between facts and dimension uses direct comparison of joined columns only (no BETWEEN...)

I guess we could over come this limitation by adding a calculated field in the temporal scd2 table that would concatenate fields ProductID + ValidFrom to recreate some kind of traditional FK between facts and Product dimension so we are still left with a nice cut in ETL development costs of SCD2 dimensions?

Has any one tried this in Practice?

Any foreseen pros unt cons?

TIA!

Rea


Implementation Using DAX in Tabular Model

$
0
0

Hi,

We have a scenario wherein we need to calculate quantity based on below mentioned condition. If week1 is selected then we need to take sum of quantities at beginning of that week and also at end of that week. If 2 weeks are selected then it should be sum of quantities at beginning of 1st week, at the end of 2nd week and at the end of 3rd week.

I have taken quantities sum at beginning and end of week for 1 week selection. Kindly help to achieve the same if more than 1 week is selected.

Thanks in adavnce.


Cube Calculations Tab Unexpected Error

$
0
0

I need to add a cube calculation. When accessing cube calculation tab in BIDS (which already had calculations) I am getting error "Unexpected error occurred:'Attempted to read or write protected memory. This is often an indication that other memory is corrupt'".

I installed many windows updates, I suppose it might be related to this error (see this).

Actually what I've lately done is uninstall office 2010 and install 2007 + updates

But I'm not sure what to remove if at all.

Please advise.

(I'm going to uninstall office again and install 2013 soon, maybe that would help)


Namnami



MDX - Calculate measure in date buckets

$
0
0

Hi,

I have an MDX problem I can't seem to solve.

I have a cube with a measure, and I'd like to calculate its value for each personnel member. However, I'd like to split its value across two age buckets: Over 365 Days and Less than 365 Days.

I have two date dimensions: one regular (a transaction date) and a snapshot period (because I'm using a snapshot fact table).

The number of days is calculated between the transaction date and the last day of the selected period (this is an attribute of the period dimension).

So for every fact row, we know in how many days are between the selected period and the day of the transaction. Depending on that value, its value should be put in one of the two buckets.

In SQL it would be very easy (and of course not in MDX):

	,[Under365 days]	= SUM(IIF(SK_TransactionDate < DATEADD(YEAR,-1,b.[PeriodEnd_Date]),0,[Amount_EUR]))
	,[Over365 days]		= SUM(IIF(SK_TransactionDate < DATEADD(YEAR,-1,b.[PeriodEnd_Date]),[Amount_EUR],0))

Any ideas on how to proceed?


MCSE SQL Server 2012 - Please mark posts as answered where appropriate.
My blog

SSAS tabular - loading data - development vs. production

$
0
0

Hi,

I understand that I can upload a subset of data, a partition, into SSAS project in Visual Studio, to make modeling faster, and then load all the data during processing on production server.

Could anyone recommend some resources I could read about this? I would love some step-by-step instructions or a tutorial. How do I load a partition in Visual Studio? How do I tell the production server to load all/some partitions when processing? 

Thanks!


SSAS Grand Total based on the Last Dimension attribute from the Pivot.

$
0
0

Hello Team,

Good Morning. With respect to the Our Business team, we do have requirement to show the EMPTY values as zero. With respect to that, we have applied below the MDX function & we were able to NULL value as zero.  

But, We have come across an issue with Grand Total Calculation. As the Grand Total is still a LAST NON EMPTY metric and as It will be a NOT NULL value, The Grand Total still getting the Last Non Empty value.

To resolve this issue, we have added a SCOPE to get the Grand Total calculation done separately. For Grand Total, We have taken the Last Child value of the respective Dimension member and we have tried to bring the value.

With this Calculation, It is try to bring the LAST value of the Dimension data associated. For example, If the Dimension Reporting month is ending with 2017 December, It is trying to the bring the value of that and associating it as Grand Total, which is not expected.

From the requirement perspective, If we selects the Reporting Year as 2013, The Grand Total should need to show the value as of December' 2013 not the 2017 Dec. Like wise, Depends on the Filter selection the respective Last Member to be choose and the calculation should be done accordingly.

Could you please suggest if we do any option to take the Grand Total value based on the Filter Selection which we did?. If we are selecting the REporting Year as 2013, It has to take the value as December' 2013 and same for 2014, iT should be December' 2014 value.

Please suggest your thoughts on the same.

Thank you.

Reagrds,

Pradeep.


Reverse Engineering - Finding incoming connection to SSAS Cube

$
0
0

Hello,

We are doing reverse engineering for one of our client for which I need help.

Client has existing environment and setup without any documentation.

We are analysing the Database, SSAS Cube, SSIS and find out the incoming connection and then make the documentation.

My question is what is the best way to look for incoming connection for SSAS Cube?

For database, I can run trace etc and get the incoming connection details but not able to figure out how to get incoming connection for one of the SSAS cube.

Please help.

Best regards,

Mohan

DISTINCT COUNT duplication

$
0
0

My cube has 12 partitions for a distinct count measure group on a serialized product (Type I SCD). However, when I query my cube at the month level for one of the serials, the value returned is 2, instead of 1 as I'd expect. A comparative relational query shows that there's only one distinct value in the table.

When I expand down to the day level, the value becomes 1. Why is this aggregation not rolling up to 1 like I would expect? Would this be an issue with the dimension design or is the partitioning causing duplication somehow?


Bucket in time dimension

$
0
0

I have the following query 


 DECLARE @Date     DATE
 DECLARE @Period INT


 SET @Date ='02/08/2016' --GETDATE()

  

 SELECT CLE.Client_Id

 , CLE.[Document Type]
 

 , CONVERT(VARCHAR(10),CLE.[Due Date],101) AS 'Due Date'
 , CLE.[Document No_]
 
 , CAST(SUM(CASE
       WHEN  DATEDIFF(DAY,CLE.[Due Date],@Date) <= 0 THEN CLE.Amount
     
       ELSE 0
   END) AS DECIMAL (9,2)) AS 'Current' --'Current'
 , CAST(SUM(CASE
       WHEN  DATEDIFF(DAY,CLE.[Due Date],@Date) BETWEEN 1 AND 15 THEN CLE.Amount
       ELSE 0
   END) AS DECIMAL (9,2)) AS '15 Days' --'1-30 Days'  
 , CAST(SUM(CASE
       WHEN  DATEDIFF(DAY,CLE.[Due Date],@Date) BETWEEN 16 AND 180 THEN CLE.Amount
     
       ELSE 0
   END) AS DECIMAL (9,2)) AS '3 Months' --'31-60 Days'
 , CAST(SUM(CASE
       WHEN DATEDIFF(DAY,CLE.[Due Date],@Date) >540 THEN CLE.Amount
    
       ELSE 0
   END) AS DECIMAL (9,2)) AS '18 Months' --'61-90 Days'
 , DATEDIFF(DAY,  CLE.[Due Date]
                        , @Date) AS 'Days Past Due'
 ,  CLE.[Due Date]
   
    AS 'Sort Date'                   
 FROM .[dbo].[FACT_Recevable] AS CLE WITH(NOLOCK)
                               
 GROUP BY CLE.Client_Id

 , CLE.[Document Type]

 
 , CONVERT(VARCHAR(10),CLE.[Due Date],101) 
 , CLE.[Document No_]
 
 , CLE.[Document No_], CLE.[Due Date]
  




How to do the sqme with ssas ? Bucket ?

Keeping set format for tabular model query using ADOMD.NET (DAX)

$
0
0

Using ADOMD.NET and writing DAX queries for a new application and none of the pre-defined formats/decimal places etc.  are being brought along for the ride.  If I have a field set as decimal and decimal places to 2 in the models properties.  It just comes over un-formatted.  Is there a setting I need to make or do I have to FORMAT(<measure>,<format string>) for everything in my DAX query.  Thus defeating the purpose of setting the formats in my model? If browsing in Excel it's formatted correctly..



Get first item of dynamic named set

$
0
0

Hello,

I created a dynamic set but I don't know how to access the items within the set.

CREATE DYNAMIC SET CurrentCube.[Dyn_Dates] as
[Date].[YearMonth].[Date].Members; 

Now I want to pass the first (string)item or member as a parameter to my C# assembly function.

I tried things like:

[Dyn_Dates].item(0),
[Dyn_Dates].lag(0),
head([Dyn_Dates], 1)

But nothing works, I don't get an valid value.

Query performance decrease when using STRTOVALUE to create a calculated measure based on a Parameter

$
0
0

Hi!

We are writing a query where the data we want to extract depends on the value of a parameter, this way we create a "dynamic" table where the fields you show in the rows change depending on the value you place in the parameters.

To do so, we are creating calculated measures that retrieve the CURRENTMEMBER.MEMBER_CAPTION of the Parameters value, which always corresponds to an attribute of a dimension, like [Hotel].[Hotel Name]. This calculated measure will be the field we will place in the table rows. What's more we are also basing on the parameter's value the data ON ROWS, so the query only retrieves the attributes we want to use in the table. 

The query does work this way, however the performance goes dramatically down. Anyone has any idea how to make the query more efficient or any alternative way to do it? Please find below the piece of the query that refers to this. 

____

WITH 

MEMBER [Measures].[Row1] AS STRTOVALUE(@pmtr_Row1+".CURRENTMEMBER.MEMBER_CAPTION")

MEMBER [Measures].[Row2] AS STRTOVALUE(@pmtr_Row2+".CURRENTMEMBER.MEMBER_CAPTION")

MEMBER [Measures].[Row3] AS STRTOVALUE(@pmtr_Row3+".CURRENTMEMBER.MEMBER_CAPTION")

MEMBER [Measures].[Row4] AS STRTOVALUE(@pmtr_Row4+".CURRENTMEMBER.MEMBER_CAPTION")

MEMBER [Measures].[Row5] AS STRTOVALUE(@pmtr_Row5+".CURRENTMEMBER.MEMBER_CAPTION")

NON EMPTY 
NONEMPTY({
STRTOMEMBER(@pmtr_Row1).CHILDREN *
STRTOMEMBER(@pmtr_Row2).CHILDREN * 
STRTOMEMBER(@pmtr_Row3).CHILDREN * 
STRTOMEMBER(@pmtr_Row4).CHILDREN *
STRTOMEMBER(@pmtr_Row5).CHILDREN},{[Measures].[X],[Measures].[Y]})
}
ON ROWS

_______

Any idea will be more than welcome!

Many thanks in advance!

Create custom dimension attribute in Visual Studio - SSAS

$
0
0

I'm creating a cube using Visual Studio 2015 and I want to explore it in different ways. Additionally, I'd like to use a reporting tool such as PowerBi (no other tools - unfortunately) - so I can't expose named sets directly with live connection.

I'd like to find a way to create a custom dimension attribute using calculations, aggregating all attributes dealing with a specific constraint. I created several calculated measures, and I created a named set (exposed indirectly to PowerBi using a flag measure as visual filter) including all attributes of a dimension on a per-calculated specific measure basis, as an example

CREATE DYNAMIC SET CURRENTCUBE.[TopX]
AS TopCount([Dim].[Dim].[All].CHILDREN, X, [Measures].[CalcMeasure]);

and it works. Now I'd like to understand the way I can obtain an attribute dimension called 'GTTopX', knowing that I can build it using the MDX command

CREATE MEMBER CURRENTCUBE.[Dim].[Dim].GTTopX
AS (AGGREGATE({EXCEPT([Dim].[Dim].[All].CHILDREN, TopX)})),
VISIBLE = 1  ;

Isn't it a dimension? I can use it in Visual Studio only as a "equal" filter, and when I try to include a measure in the browser this error message appears:

A set has been encountered that cannot contain calculated members

However, if I try declaring it directly querying the cube using SSMS and then performing a select in this way

WITH MEMBER [Dim].[Dim].[GTTopX] AS
AGGREGATE(EXCEPT([Dim].[Dim].[All].Children, [TopX]))
SELECT [Measures].[CalcMeasureRandom] ON ROWS, [Dim].[Dim].[GTTopX] ON COLUMNS FROM [Cube]

the query gives me the correct result, showing the selected "dimension attribute" called as "GTTopX" .

How can I perform the same thing in Visual Studio?

LazyWriter - insufficient disk quota when processing OLAP database

$
0
0

Hi!

 

I am getting the error in subject not always, but more and more frequently on a server in production during OLAP processing. The full error log is as follows:

 

File system error: A FileStore error from WriteFile occurred. Physical file: \\?\D:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\Data\OLAP.0.db\Customer.0.dim\10.Customer Key.asstore. Logical file: . : Insufficient quota to complete the requested service. .

File system error: The following error occurred while writing to the file 'LazyWriter Stream': Insufficient quota to complete the requested service. .

File system error: The background thread running lazy writer encountered an I/O error. Physical file: \\?\D:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\Data\OLAP.0.db\Customer.0.dim\10.Customer Key.asstore. Logical file: .

 

When this happens the OLAP service is usually shut down also. Has anyone encountered this before?

I found something similar in the SQL Server db engine forum saying it is due to lack of available memory: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=746299&SiteID=1

The server is running Windows Server 2003 Enterprise and SQL Server 2005 Enterprise editions and has got 16 gb physical RAM. Of the 16 gb I have assigned 11 gb for SQL Server, so there is another 5 gb left for OS and Analysis Services and the other applications, so there should be at least a few gb over for analysis Services to play with.

 

Any input would be greatly appreciated. Thanks!

 

How to add couple of calculated measures in an existing SSAS cube available in production

$
0
0

Hi there,

Is there a way I can create couple of calculated measures in a SSAS cube available in production. The requirement is these measures should be available when the year moves to next year. So I thought an approach to provide an script to support team so that the script can be run every year end by just modifying year in the script.

Can we achieve this using XMLA/MDX/DMV as I would not like to execute whole calculate script and instead I want to make this script simple and only new measures should be added which will be same lines of code every year and just replace the year.

Thanks,

Palash


Unexpected Error Occurred

$
0
0

Hi All,

   For some unknown reason in SSAS 2016, I am getting unexpected error occurred when access measures in pivot table in excel. This error is causing SSRS report to fail too. Log is not helpful in debugging the error. Can anybody help me out in this issue?

passing an mdx function as a parameter to a Reporting Action

$
0
0
Hi all, 

I am trying to create a reporting action that will run an SSRS report that displays data related to the current cell being browsed in excel.
The cell context consist of a fairly large number of integers which need to be somehow passed to the reporting engine, but a comma separated list of numbers will not work as the url based parameters are too restrictive in terms of length and I need a few thousands of them.
I was thinking a the Analysis Services Stored Procedure Project which exposes a function ASSP.GetDefaultDrillthroughMDX that will retrieve the MDX associated with a drill through action for that particular cell, however it doesn't seem to work for me.
I tried creating a parameter for that action that looks something like:
UrlEscapeFragment(ASSP.GetDefaultDrillthroughMDX([Measures].[Number of Claims])) which if invoked from SSMS will actually return a valid MDX statement, and I was hoping to be able to send this MDX to SSRS where I will call a stored proc and find the list of identifiers needed for my report. However, nothing makes it across to the reporting services, actually the SSRS Report will not even be invoked at all for seome reason, which denotes an error in the action parameter.
Is there a way to use MDX functions embedded in the action parameter?
Is there any way to debug and see what is being passed around in this case - the profiler doesn;t capture anything and I cannot see any error in any logs or events.
Thanks!

SSAS Named Set Using [Dim Date].[START OF WEEK STARTING SUN DATE]

$
0
0

I'm trying to create a named set in my cube.  In my date dimension I've got the both [Date] and [Start of week starting sun date].  What I want to do is create a named set using [Start of week starting sun date] and have it give me the most recent 4 weeks.  So to recap, the data looks like this:

DATE START OF WEEK   STARTING SUN DATE
7/1/2016 6/26/2016
7/2/2016 6/26/2016
7/3/2016 7/3/2016
7/4/2016 7/3/2016
7/5/2016 7/3/2016
7/6/2016 7/3/2016
7/7/2016 7/3/2016

What I've tried to implement for the named set is as follows:

{
strtomember("[Dim Date].[START OF WEEK STARTING SUN DATE].&[" +
 cstr(year(now())) + "-" +
 Right('0'+ cstr(Month(dateadd('m',-1,now()))),2) + "-" +
 Right('0'+ cstr(Day(now())),2)+"T00:00:00]")
:
strtomember("[Dim Date].[START OF WEEK STARTING SUN DATE].&[" +
 cstr(year(now())) + "-" +
 Right('0'+ cstr(Month(now())),2) + "-" +
 Right('0'+ cstr(Day(now())),2)+"T00:00:00]")}
This approach works when I use just [Dim Date].[Date] however when I substitute that with [Dim Date].[START OF WEEK STARTING SUN DATE] I start running into problems due to the fact that not every date exists in [Dim Date].[START OF WEEK STARTING SUN DATE].  My question is, how could I implement something like this?

DAX - Columns in table variables cannot be referenced via TableName[ColumnName] syntax

$
0
0

I'm trying to make a temporary table and apply a filter to it. It seems I cannot refer to a specific column of a temporary table (functional limitation of tables from VAR declaration). What is the work around? See below example DAX code.

Thanks in advance,

Robin

Rpt Order Cust Cnt :=
VAR temptable =
    SUMMARIZE (
        'Sales Detail',
        'Sales Detail'[Customer No.],"Unik inv knt", DISTINCTCOUNT ( 'Sales Detail'[Invoice No.] )
    )
RETURN
    CALCULATE ( COUNTROWS ( 'Sales Detail' ), temptable[Unik inv knt] > 1 )


Reference relationship issue

$
0
0
Hello,

I am a bit confused about the whole reference dimensions capabilities. So I am not sure if the setup I created will actually work or not. Maybe somebody can point me in the right direction.

Let me start with a problem. My schema is based on a factless fact. One row represents a member of an organization. A member can be part of "zero to many" associations (the source stores the list of all member associations as a concatenated string). The goal is to report on how many members belong to a particular association. 

Here is how I have my dimensions setup:

Fact.AssociationGroupKey references DimAssociationGroup.AssociationGroupKey. 

DimAssociationGroup has a list of groups/"concatenated strings" of all existing permutations of associations. Example of a row: (1, "AAA,BBB,ZZZ")

DimAssociationsGroupCode references the DimAssociationGroup and has every group broken down. Example of 3 rows: (1, "AAA", 11), (1, "BBB", 22), (1, "ZZZ", 33)

DimAssociation has a list of all known associations with codes and descriptions. Example: (11,"AAA", "Description of AAA")

Is the setup like that going to work, considering that I have different granularity: associations group at the fact level and individual associations to report on?

I have setup regular relationship between the fact and DimAssociationGroup.

Referenced relation between DimAssociationGroup  and DimAssociationsGroupCode based on the AssociationGroupKey; and Referenced relation between DimAssociationsGroupCode and DimAssociation using AssociationKey.

When I have everything but DimAssociation configured it allows me to Process the cube, but as soon as I add DimAssociation it throws an error "The 'Association Code' intermediate granularity attribute of the 'DimAssociationGroupCode' measure group dimension does not have an attribute hierarchy enabled."

I do have the hierarchy setup in the DimAssociationGroupCode.

Thanks
Viewing all 14337 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>