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

How to calculate the root of filtered members based on another filter

$
0
0

Hello All,

  Please find the below query.

with member agg as 
sum(

exists([Product].[OTC1].[OTC1],existing([Product].[Pack].[Pack])])
,[Measures].[Values HNA])

select 
agg on 0 from cube where [Product].[Product].&[101]

For a particular product am trying to know the existing packs associated with it and then finding the OTC1's for which we are having sales for a product. 

I want to find the total sales(all product sales) for the OTC1's which are having sales for the filtered product.

Note- In filtered it can be any other product attributes not only product so am going to the lowest level pack to identify the OTC1's.

Regards,

Bharath



average balance in year for the selected month

$
0
0

Hi all,

Tried to write MDX to show average balance for the year for the selected month.

2009           2 (avg bal)

          01    1

         02      2

         03       3

existing code...

measure.[bal]/count(nonempty(date.period.currentmember.children,measures.bal))

But the above code works when year is selected with all month. But when selecting few months (month 01, 02), the result

is showing as 1. 

  3/3 =1 (denominator is all children for the year irrespective month selection). Need help how to get correct avg balance when selecting particular month in a year.  when selecting month 02 and 03 the avg balance is 5/2 = 2.5

tried below calculation as well. still the same result.

Avg( Descendants([Date].[period].currentmember
, [Date].[period].[Month])
, [Measures].[bal]
)


Thank you.

Analysis service deployment wizard

$
0
0

Hi,

I'm able to invoke and deploy successfully using command prompt my tabular cube in my local machine. But when I'm executing the command in command prompt inside Dev server box, it is just coming out without deploying or throwing any error. Not sure what is missing?

Please suggest.

C:\>Microsoft.AnalysisServices.Deployment.exe "<<Location>>\Model.asdatabse" /s

The above is working in command prompt in my machine but not in dev server box for SQL server.

Cheers

SSAS Cube failure

$
0
0

Dear members,

I am getting the below error, but however when i restore the cube and process i will not see the error.

Could you guys please help me resolving this issue.

The above error is appearing frequently and cube is failing

I have checked the data, i don't see any data issue, as when i restore the cube and process the error which i have shown above will not appear.

Regards

Naveen

Include month from DIM Date table that have matching records in Fact table

$
0
0

Hello!

I have a cube where I have a fact and date tables. I have established the relationship between them so that I can perform time intelligence functions. In power BI report, I have used "year" from Date table as a slicer. The problem is every single year in the DIMDate table is appearing in that slicer. I want it, so it only displays years that match with the data that is the Fact table. Is it possible?

Regards

PV

Add dimension in existing Cube with new a attribute in fact table

$
0
0

hi, I would like to add dimension in existing Cube that is new a attribute in fact table. Also I got lots of data in existing cube. How can I merge or keep old history data in cube? No previous raw data in fact table right now. I found when I add new dimension for cube, it need perform "Process Full" for the cube, it clear all old history in cube. How can I do? Thank you.


SSAS Cube Corruption

$
0
0

Dear members,

I am getting the below error, but however when i restore the cube and process i will not see the error.

Could you guys please help me resolving this issue.

The above error is appearing frequently and cube is failing

I have checked the data, i don't see any data issue, as when i restore the cube and process the error which i have shown above will not appear.

Regards

Naveen


Full Cube Process Script sets Attribute to "Unknown" and when i do a process full on dimension attribute afterwards the attribute is correct

$
0
0

Hi,

I do a full process on cube in job agent script but then a dimension attribute is set "Unknown'

Then afterwards I do a dimensional process full then the attribute value is correct.

How do I fix, every time I do a process the attribute is lost

I tried two steps in job where full process > dimensional process full but it does not seem to work

Please help


MDX Date Dependent Formula

$
0
0

I need help writing a date dependent formula in MDX.  I am not very experienced with proper syntax, and just try to mimic other working formulas by trial and error.

Basically, I want one formula if the date is between Nov 2017 and Apr 2019, otherwise use a different formula.  Below is what I tried, but I am not getting the desired results.

Case when ([Effective Date].[FY Date].[Month].CURRENTMEMBER.MEMBERVALUE >= [Effective Date].[FY Date].[Month]&[FY 2017-Nov] and[Effective Date].[FY Date].[Month].CURRENTMEMBER.MEMBERVALUE <= [Effective Date].[FY Date].[Month]&[FY 2019-Apr]) then

[Account].[Account].&[7147]-

[Account].[Account].&[4388]-

[Account].[Account].&[4387]-

[Account].[Account].&[4309]-

[Account].[Account].&[4312]+

[Account].[Account].&[5625]+

[Account].[Account].&[7408]

else

[Account].[Account].&[7147]-

[Account].[Account].&[4388]-

[Account].[Account].&[4387]-

[Account].[Account].&[4309]-

[Account].[Account].&[4312]

ASTrace and SQL Server 2016

$
0
0

Hi,

We've been using ASTRACE with SQL 2012/Windows Server 2008 R2 for a good while now. We are currently migrating to new SQL Server 2016 SP1/CU1 Windows 2012 R2 servers. I have tried to install the version of AStrace we have been using on 2012 and also copied the latest ASTrace from GitHub.

It seems to install OK but I cannot start the service  - I get the following error:

Log Name:      Application
Source:        .NET Runtime
Date:          11/04/2017 16:30:41
Event ID:      1026
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      XXXWISQLP14.BlueCrest.local
Description:
Application: ASTrace.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException

Exception Info: System.IO.FileNotFoundException
   at ASTrace.Trace..ctor()
   at ASTrace.Program.Main()

Does anyone have any suggestions, please, why I am having this issue? The config file is shown below and the service account should have permissions:

regardd

Ken

<?xml version="1.0"?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <section name="ASTrace.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
        </sectionGroup>
    </configSections>
    <applicationSettings>
        <ASTrace.Properties.Settings>
            <setting name="AnalysisServerNames" serializeAs="String">
                <value>XXXWISQLP14\SSAS01</value>
            </setting>
            <setting name="SQLServer" serializeAs="String">
                <value>XXXLWISQLP14\INST01</value>
            </setting>
            <setting name="SQLServerDatabase" serializeAs="String">
                <value>TraceDB</value>
            </setting>
            <setting name="TraceTableName" serializeAs="String">
                <value>ASTraceTable</value>
            </setting>
            <setting name="TraceDefinition" serializeAs="String">
                <value>Standard.tdf</value>
            </setting>
            <setting name="PreserveHistory" serializeAs="String">
                <value>True</value>
            </setting>
            <setting name="RestartRetries" serializeAs="String">
                <value>3</value>
            </setting>
            <setting name="RestartDelayMinutes" serializeAs="String">
                <value>5</value>
            </setting>
        </ASTrace.Properties.Settings>
    </applicationSettings>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="Microsoft.SqlServer.ConnectionInfo" publicKeyToken="89845dcd8080cc91" />
            <bindingRedirect oldVersion="10.0.0.0" newVersion="11.0.0.0" />
            <publisherPolicy apply="no" />
         </dependentAssembly>
      </assemblyBinding>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="Microsoft.SqlServer.ConnectionInfoExtended" publicKeyToken="89845dcd8080cc91" />
            <bindingRedirect oldVersion="10.0.0.0" newVersion="11.0.0.0" />
            <publisherPolicy apply="no" />
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>



Ken E


Business Intelligence Semantic Model folder

$
0
0

Hi,

I have installed MSBUILD and inside the MSBUILD folder in my Program files, i can find "Business Intelligence Semantic Model" folder. But when i installed MSBUILD in my colleagues machine the folder is not available.

Would like to know if the "Business Intelligence Semantic Model" folder is a part of which installation?

Is it a part of MSBUILD or SSDT or upgrade of Visual studio or some other installation which i did and got the folder inside MSBUILD.

Reason for asking this question - When my colleague was trying to Build a tabular cube using MSBUID, it failed with the error 

"Microsoft.AnalysisServices.VSHostBuilder is not available." The error got resolved after placing the "Business Intelligence Semantic Model" folder inside his MSBUILD folder. So would like to know how this folder ("Business Intelligence Semantic Model" folder) gets created.

Cheers

Jim

TOTALYTD Issue When Trying to Use One Measure (with a switch) When Some Units Use Calendar Year-end and others use Fiscal Year-ends

$
0
0

So the issue that we are running into deals with calculating YTD properly when some business units are on a different fiscal year. Some business units are Calendar Year and others are Fiscal Year (year end of 6/30). What we did for the setup is as follows:
We created a “Year End” column in the Business Unit dimension table. This denotes either a year end of 6/30 or a year end of 12/31. Next, in our fact data table (Profit and Loss) I created a LOOKUPVALUE column that looks up the value (6/30 or 12/31 from the Business Unit dimension table) and another column called YearEndSwitch (either a 1 or a 2 based on 6/30 or 12/31). I cannot use this Switch in an IF statement, so I created a hidden YearEndSwitchMeasure that uses the AVERAGE calculation to give me either a 1 or a 2 in an IF statement.

Example:
Dollars Actual YTD:=if([YearEndSwitchMeasure]=1, TOTALYTD([Dollars Actual], 'Time'[ApplyDate], "06/30"), TOTALYTD([Dollars Actual], 'Time'[ApplyDate], "12/31"))

The issue here is that I will only get a YearEndSwitchMeasure value of 1 or a 2 *if* there is an actual row value present. So for example, if we have a Dollar amount in a certain account for a certain business unit for January, the YearEndSwitchMeasure will assign a 1 or a 2 based on Year End. But if there is no value for February, TOTALYTD will not calculate correct because the IF statement cannot determine if it is a 1 or a 2 (because it is actually a BLANK!)
We are trying to avoid having to use two separate YTD Measures based on 6/30 or 12/31 Year End. We would like to use a single YTD measure, but this seems difficult since we cannot get a switch to work to automatically determine which one a business unit is using.
We have tried using LOOKUPVALUE but that does not work in the context of a measure.

Thanks in advance!

Rich

6.3.6

IRowset.GetNextRows failed with DB_S_ENDOFROWSET

$
0
0

Hi dear all,

I'm trying to read some rows from MDSCHEMA_CUBES table , the code is as follow

   

void coledb::query()
{
  HRESULT hr;
  IDBSchemaRowset *schema = nullptr;
  hr = m_session->CreateSession(nullptr,__uuidof(IDBSchemaRowset),(IUnknown**)&schema);

  if (SUCCEEDED(hr))
  {
    IRowset *rs = nullptr;      
    auto nams = {L"CATALOG_NAME",L"SCHEMA_NAME",L"CUBE_NAME"};
    unsigned idx = 0;
    VARIANT cols[3] = {0};
    for(int i = 0 ; i<3; i++) VariantInit(&cols[i]);
    for( auto &nam : nams)
    {
      cols[idx].vt = VT_BSTR;
      cols[idx].bstrVal = SysAllocString(nam);
      idx++;
    }
    hr = schema->GetRowset(nullptr,schema::MDSCHEMA_CUBES,3,cols,__uuidof(IRowset),0,nullptr,(IUnknown**)&rs);
    if (SUCCEEDED(hr))
    {
      DBCOUNTITEM count = 0;
      HROW        *row = nullptr;
      hr = rs->GetNextRows(DB_NULL_HCHAPTER,0,1,&count,&row);    
      printf("fetched %lld , %08X\n",count,hr);
      if (rs) rs->Release();
    }
  }

  if(schema) schema->Release();
}

after some search , I've found the rs had its DBPROP_ROWSET_ASYNCH property set to 

DBPROPVAL_ASYNCH_INITIALIZE DBPROPVAL_ASYNCH_SEQUENTIALPOPULATION DBPROPVAL_ASYNCH_BACKGROUNDPOPULATION

this seem the reason I got DB_S_ENDOFROWSET ,

so , my question is is it possible to change the IRowset to a synchronous one ? many thanks !!!

Tabular 2019 compatibility level 1500: unable to process table or deploy?

$
0
0

I have found that using SQL Server SSAS 2019 models work fine up to compatibility level 1400.

However, after changing it to level 1500 I am no longer able to process tables locally or deploy.  

Once set to level 1500 and attempting to deploy or process I get the error:

Failed to save modifications to the server. Error returned: 'An unexpected exception occurred.

'.

SQL Server Analysis Services

$
0
0
Backgroung:
We have allocated separate server with to SQL Analysis service. 
Having 32 GB static RAM and upto 64 GB dynamic RAM.
Pus we have almost 65 Database in Analysis service.
Issue:
When ever the server or the Analysis service get restarted. Analysis service take a lot of time and also it waits to consume 6 GB of memory before it get responsive.
This behavior is just for first time running the Analysis service. After that Analysis service work fine.

Can anyone know what is happening in the start of service that causing this much delay.
I really appreciate all your time and help in this.

MDX Measure - Count based on date

$
0
0

Hi All,

I am trying to develop a measure to count the number of times something happens daily. This is the condition:

IIF([Measures].[Sstk Qty] > 0

AND[Measures].[A+C Quantity] <= 0 ,1, NULL)

So I want to be able to figure out how many times this happens per month, or week, or quarter, or whatever date slicer I use. Right now this only produces 1 or Null for any given data level. So if this condition was true 9 times in the month of Novemeber and I had month in my query, I would see 9 as the answer. Currently I see 1.

Thanks,

Mike

MDX incorrectly summing result of multiplication of percentages

$
0
0

I am multiplying one set of values against a corresponding set of other values and wish to sum the result of all the products.  I am querying using MDX and when I get the results from the query and sum them in excel, they add up to the correct number.  However, when MDX sums them, the number is off.

The calculation works as follows:

I am multiplying a "Yearly Average Save Rate" percentage times a "Account Volume" percentage.   Both of the percentages are subdivided into buckets with a couple dimensions.  The multiplication is like the SUMPRODUCT function in excel, the save rate percentage in bucket A is multiplied by the Account Volume percentage in bucket A, and so on.

If I look at the result of January 2018, I see the products of these multiplications are:


  • 7.71%
  • 17.88%
  • 0.60%
  • 22.22%
  • 15.14%
  • 0.47%

When I sum these in excel, I get 64.02%.  When I use MDX, I get 63.83%.  Here is my MDX so far for creating some of the calculated members:

WITH MEMBER [save rate times volume]
AS
(
    [Measures].[Non-fixed Principal Save Rate] * [Measures].[Target Setting Account Volume]
), 
FORMAT_STRING = "PERCENT"

MEMBER [Average yearly Save Rate]
AS
(
   Avg( 
         
           ([Measures].[Non-fixed Principal Save Rate], 
            [Date].[Calendar Month].[All])
   )         
)

MEMBER [volume times yearly save rate average]
AS
(
 [Measures].[Target Setting Account Volume]  *  [Average yearly Save Rate]
)


[volume times yearly save rate average] is the calculated measure that provides the values in my example above.  Anybody have any idea why MDX calculates the SUM of these percentages incorrectly?  or any advice on how to ensure it calculates correctly?


Process Cube SSAS

$
0
0

Hi,

I have the DIM_DATE dimension that has three relationships and DIM_Geography that has two relationships.

When I do the processing for SSAS these dimensions divide one for the number of relationships.

Ex: The DIM_DATE dimension that has three relationships to the fact, so it will have three dimensions when I do the processing.

How do I set dimensions so that when I render processing, only one dimension appears, such as the Product Dimension ?.

Thank you all
_Keny


Keny Maciel da Silva DBA SQL Server MCSA - Administering a Microsoft SQL Server 2012/2014 Database MCSA - Querying Microsoft SQL Server 2012/2014 MCTS - SQL Server 2008, Installation and Maintenance Email: kenymaciel@gmail.com

What columns should be essentially included in Partition Query

$
0
0

Hi All,

As I understand one of the performance technique is Only required column should be included in the partition query.

Such as: If 3 measures of the MeasureGroup in a cube is based on A, B and C columns out of total 10 columns in the underline fact table, then Only A, B & C column should be selected in the partition query. (Please correct me if wrong)

Based on above understanding I have question here:

lets say: if Column D from fact table is getting used as a key to establish relationship between fact and dimension, should we also include column D in partition query?

If I remove column D from partition query, will it give error or only relationship between Dimensions & Fact will be missing. and why?

request you to please suggest/ comment?

Many thanks & regards,



Partition data vs Data Source View

$
0
0

Good day.

I would like to ask for some assistance/advise. I do not work too much with ssas cube development so please forgive me if i am asking stupid questions.

i have a particular cube that i would like to partition into individual years. i have one query in the DSV. I have created all the separate partitions into each individual years by restricting the data in the 'WHERE' clause of the sql query (which is the same query in the DSV).

i have created partitions for years 2015,2016,2017. i then restricted the data in the DSV to look at data from 2018 to current. This is where i seem to be getting stuck, is that the correct way to to create the partitions? After doing this now i only get calendar years for 2018 and 2019 in my Date/Time dimensions when pulling data into Excel. But when i browse this dimension inside of BIDS i see Calendars from 2009 to 2019.

i am not sure if i am correctly creating the partitions (probably not if i am not getting the desired results). i have a few questions if i may to try and help me understand a few things.

  1. Do i have to restrict my DSV query as well to only look at data from 2018 to current if i have already restricted these values in my partitions or should my DSV have all data with no restrictions?
  2. Do i need to have a partition for 2018 to current (that matches my DSV - same 'WHERE' restriction) as well as other partitions (2015,2016,2017)

I am using BIDS 2008.

any help would be greatly appreciated.

Viewing all 14337 articles
Browse latest View live