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

Calculated Measure LFL Grand Total

$
0
0

Hi

I have a cube that has Products, Store,Date,Sales Type.

I have two calculated measure

Mature Sales This Year

Sales Last Year

The Mature Sales Measure uses Parallel Period,

CREATE

MEMBERCURRENTCUBE.[Measures].[Mature Net Sales This Year]

ASCASEWHEN (

[Measures].[Mature Net Sales Value],

PARALLELPERIOD ([01 - Date].[Calendar].[Financial Year], 0, [01 - Date].[Calendar].CurrentMember)) =0 THENNULLELSE

(

[Measures].[Mature Net Sales Value],

PARALLELPERIOD ([01 - Date].[Calendar].[Financial Year], 0, [01 - Date].[Calendar].CurrentMember))

I have a measure that shows Sales Last Year

CREATE

MEMBERCURRENTCUBE.[Measures].[Net Sales Last Year]

AS


iif

([Measures].[Mature Net Sales This Year] >0,


--case when [Measures].[Mature Net Sales This Year] >0 then


sum

(EXISTING

[Measures].[Net Sales Value],

PARALLELPERIOD ([01 - Date].[Calendar].[Financial Year], 1, [01 - Date].[Calendar].CurrentMember)

),

null ),


FORMAT_STRING

= "#,##.00",


NON_EMPTY_BEHAVIOR

= { [Measures].[Mature Net Sales Value] },


VISIBLE

= 1 ,  DISPLAY_FOLDER ='LFL Measures'ASSOCIATED_MEASURE_GROUP ='01- Sales'  ;



END

,


FORMAT_STRING

= "#,#.00",


NON_EMPTY_BEHAVIOR

= { [Measures].[Mature Net Sales Value] },


VISIBLE

= 1 ,  DISPLAY_FOLDER ='LFL Measures'ASSOCIATED_MEASURE_GROUP ='01- Sales'  ;

The issue is the displaying of Grand Total if I filter the dimensions by and attribute (Select Few Products etc) the grand total displays correct, the moment I use select all attribute from any dimension the grand Total displays the wrong value.

The Grand Total is not filtering out the shops that did not have mature sales this year.

FYI - The business logic is if there are mature sales this year for the selected period, show last years sales.

Many Thanks

Dan


Different compatibility level for a SSAS Tabular project

$
0
0

Hi,

I've copied a Tabular project from a dev environment to a prod environment. I've SQL Server 2012 SP1 on both environments.

When I try to open the tabular project in the prod environment I can see only SQL Server 2012 RTM (1100) compatibility level, but in the model properties I can see SQL Server 2012 SP1.

I've tried to install the most recent setup of SSDT for Visual Studio 2010, but I've obtained any results.

Moreover, in the prod environment the supported compatibility level for SSAS Tabular instance is 1103 (version 11.0.3000.0).

How can I solve this issue, please? Thanks

SSAS Cube Calculations Sum does not calculate correctly

$
0
0
Dear all
I am working with SQL Server 2012 SSAS.
I build my Cube everything is working very good.
I want to make a new “Calculations”
Create Member CurrentCube.Measures.[X]
AS
Sum(
{
[Market].[Market]. CurrentMember
[Region].[Region]. CurrentMember,
[Month].[Month]. CurrentMember
},
[Measures].[Value]);

It is not calculating right ?

Month      Country      Region              Market              SKU                Value               X
January      Egypt      Alexandria      Croissant        MoltoWC       261570.00      728390.00
January      Egypt      Alexandria      Croissant        MoltoSC       201500.00      728390.00
January      Egypt      Alexandria      Croissant        BrunchTC      2550.00          728390.00
January      Egypt      Alexandria      Croissant        BrunchTP      262770.00      728390.00
                                                                         Total                    728390.00      


The idea is that I want to 
Sum(Value)  Where (Market = Market and Region = Region and Month = Month)

Thanks,

Ramzy N.Ebeid


Dimension Rename

$
0
0

Good morning,

When I create the cube dimensions are automatically created with the name of the tables that are related to factual.

I did a test and when I change the name of a dimension in the project it is not changed in the cube and vice versa.

My question relates to the following:

There is a problem rename the dimensions only within the cube? Or when switching should be a change in the other side.

Performance can be affected by the fact that the name be different from the project name that exists in the cube?


Obrigado, Élio Godinho

Sets in SSAS based on selected Value in Slicer

$
0
0

Hi

I have a situation in which , I need to show the 4 week in the column based on the slected value on the slicer. For example , IF user select week48 on slicer.. then my table should show the value of measer for week45,week46,week47,week48.

I tried this by creating sets in SSAS using currentmember of date hierarchy But when I use date hierarchy then excel doesn't allow me to create slicer based on date hierarchy.

Thanks in advance..


lntinfotech

Distinct Count Calculation

$
0
0

Hello everybody,

I have a cube with appointments including dimensions for companies and dates.

One of my measures is "Appointments" which is the count of all appointments. Another calculated member is "Visits" which is the count of appointments with the type of "Visits".

This is my MDX epxression for "Visits":

AGGREGATE([Appointment].[Type].&[Visit], [Measures].[Appointments])

Now I would like to create a new calculated member "Company Visits" which should be the distinct count of "Visits" by company and date.

Example: 2 "Visits" in one company on the same day should be 1 "Company Visit"

In T-SQL this query works:

COUNT(
   DISTINCT(
      CASE [Type]
         WHEN "Visit" THEN CAST([CompanyID] AS NVARCHAR) + CONVERT(NCHAR(8), CAST([Date] AS NVARCHAR))
         ELSE NULL
      END
   )
) AS [Company Visits]

How can I do this with MDX in calculations?

Additionally I would like to have a calculated member "Days in Field" as distinct count of dates with "Visits".

Thanks in advance and best regards

Lars


Are annotations depreciated or safe to use?

$
0
0

In BIDS you could add custom annotations against the cube, dimensions, hierarchies, etc. In SQL Server Data Tools that option does not appear to be there at all. Is there away to set them in SQL Data Tools?

I can however still set the annotations using AMO. Have the annotations been depreciated or is it still safe to use them?

Thanks

Chris

MDX Using iif function to supress 1.#INF error not working

$
0
0

 Hi All

I am trying to do a calculation using 2 calculated members, one of the values can = 0 which when dividing creates the1.#INF, i have attempted to use an iif function to work around it but it doesnt seem to be working. can anyone say why its not working or what i can do to fix it?

the code and result set are bleow

with member Measures.Total as
sum (
PERIODSTODATE( [Date 1].[Hierarchy].[Year Month Desc] ,
[Date 1].[Hierarchy].currentmember
) * [Date 1].[Workdays Past In Month].DefaultMember *  [Date 1].[Workdays Left In Month].DefaultMember,
 [Measures].[New Start])
 member measures.DaysPast as   [Date 1].[Workdays Past In Month].member_Caption
 MEMBER [Measures].[NullValue] AS Null
 member measures.TestAvgStart as iif(  [measures].[DaysPast]  = 0 ,[Measures].[NullValue] , (Measures.Total/measures.DaysPast)), FORMAT_STRING = "#,#0"
--------------------------------------------------------------------------------
select {[Measures].[New Start],Measures.Total,measures.DaysPast,measures.TestAvgStart }    on 0 ,
(
 [Date 1].[Hierarchy].[Full Date]
,[Date 1].[Workdays Past In Month].children
,[Date 1].[Workdays Left In Month].children
) 
on 1
from sales
where [Date 1].[Previous Month].[1]

DateDays PastDays left New StartTotalDaysPastTestAvgStart
01/06/201302069690         1.#INF
02/06/20130204730          1.#INF
03/06/20131191241971197
04/06/20132181413382169
05/06/20133171244623154
06/06/20134161586204155




Connect method gets freezed for long time

$
0
0

Hi,

I am trying to connect to Analysis Services using Microsoft.AnalysisServices library in C#. I found that sometimes the site takes too long to load stalled in "Waiting for .. ". When I debugged the controller constructor I found that the call to

OLAPServerobject.Connect(ConnectionString) is where the it is getting blocked. Any idea why it is taking a long time waiting in this method? Have anyone faced this issue before?

create single-value measure from a measure array

$
0
0

I need some education on MDX.. :) I have Measure A which gets calculated across Dimensions Dim X, DimY and DimMonthly.

is there a way or maybe function to create Measure B derived from measure A but selects only single Measure A value attributed to  LastMonthValue (e.g. relative to today, Nov 2013 for today) and crosses DimMonthly on Nov 2013?

What should I use

filter - Filter Nov 2013?

Tail function with item(0)?

or create  Measure B based on default named set = Nov 2013

or it could be done only using SELECT?

...?




SSAS using datasource at query time

$
0
0

I have a set of reports that run against the cube.  The cube has proactive caching enabled.  If the datasource within the SSAS database has invalid credentials, queries against the cube will not run.  Note: SSAS is setup to run as network service rather than a domain account (temporary situation).

My understanding of MOLAP is that the data is stored within the cube an no access to the source (sql server datamart) is needed for the user to run queries against the cube.  Now this is proving to not be true... leaving me feeling like I don't know what is going on at all.  After 7 years using SSAS I'm finding out that the user's queries don't actually run against the cube, they require that ssas be able to connect to its source data to satisfy the query???!?!?!??!?

I really really don't understand this, but I have tested repeatedly and when I set the datasource to invalid credentials, report queries won't run or just return 0's.  Earlier we were getting 08001 "can't connect to server" messages, now I'm just getting all 0's on the reports when the datasource credentials are invalid.

Just to make this 100% clear, I am talking about the SSAS datasource within the SSAS database, not the SSRS datasource that points to the cube.  Has anyone ever seen this before?  To make it more confusing, now it seems to be working in excel regardless but SSRS still needs the valid datasource.

Thanks,

Ken

SSAS Custom Assembly

$
0
0
Dear all

i am working with SSAS and i did build my cube.

1 - i want to create a custom assembly 
2 - add this assembly in a calculated member 
3 - that takes parameter (the selected dimensions + Measures)
4 - the result of this calculated member will be calcualated inside the assembly and returned back to the user as a new measure.

also how can i make a custom assembly that open a connection with SQL Server or SSAS?

thanks,

Ramzy N.Ebeid

SCOPE Statement

$
0
0



I try understand how work Scope Statement (SSAS 2012). I write very simple code on Calculations tab in Cube Designer (I switch to Script View):

Calculate;

Create Member Currentcube.Measures.MyMeasure as null, visible=1;

Scope(Measures.MyMeasure);
THIS=100;
End Scope;

But Scope Statement marks as error. What is this problem?



MDX for Last 2 Members in Fact, not from Dim

$
0
0

I'm trying to write an mdx that will give me the last 2 Products sold in my Fact table, but instead of that, I always get the latest 2 Products in my Dim table sold. I've googled it, but cannot get the right mdx, so I can retrieve the last records in my fact. So far I have:

WITH MEMBER [last] as

FILTER([DIM_PRODUCT].[PRODUCT_ID].[PRODUCT_ID].MEMBERS,[Measures].[Row Count]).item(
FILTER([DIM_PRODUCT].[PRODUCT_ID].[PRODUCT_ID].MEMBERS,[Measures].[Row Count]).count-1).name

MEMBER [previous] as

FILTER([DIM_PRODUCT].[PRODUCT_ID].[PRODUCT_ID].MEMBERS,[Measures].[Row Count]).item(
FILTER([DIM_PRODUCT].[PRODUCT_ID].[PRODUCT_ID].MEMBERS,[Measures].[Row Count]).count-2).name

SELECT {[last],[previous]} on COLUMNS
FROM [Cube]
where [DIM_WAREHOUSE].[WAREHOUSE_ID].&[2]

Any help will be highly appreciated. Thanks!

A Strange Problem that Seems to Stump Everyone

$
0
0

Here's a question that has stumped everyone I've asked so far.  I'll create a simplified example here.  For every calculated measure in my cube, I witness this phenomenon.  It looks like some kind of crazy rounding error, but I can't figure out why that would be.  I'm working with straightforward financial data, so every number has just two decimal places.  I'm only summing, not doing division, so the number of decimal places should not change.  Nevertheless, this is what I see:

                  January      February       March         ALL

Revenue:      $10.00        $10.00       $10.00       $30.0173519

What on Earth could cause this and how can I fix it?  When I'm looking at tens of millions of dollars, I could be over or under by as much as +/-$30.  I have financial reports where certain columns are supposed to tie out to zero and they never do.  We've lived with it for a while, but it's starting to raise a few eyebrows.


BrainE


SSAS - Performance Issue - time out /locking conflicts

$
0
0
 

Hi,

We have a cube which has 5 measure Group.<o:p></o:p>

4 of the measure groups are partition<o:p></o:p>

Each measure Group have 4 partition  and no aggregation designed,<o:p></o:p>

Client is excel and user has created report /dashboard.<o:p></o:p>

Until a week before reports were working fine and suddenly reports started timing out or query which used to take seconds now started taking minutes.<o:p></o:p>

Some of the reports error message were<o:p></o:p>

"Data could not be retrieved from the external data source. Error message returns by the external data source. Server : The operation was cancelled because of locking conflicts".<o:p></o:p>

I don't know from where should I start..<o:p></o:p>

 MDX queries or any setting on the msmdsv.ini.

<o:p></o:p>

<o:p>we have written MDX queries to calculate dollar value for an item and rollup using weightedaverage.</o:p>

<o:p></o:p>

Any help will be appreciated.<o:p></o:p>

<o:p> </o:p>

Thanks<o:p></o:p>

Suraj<o:p></o:p>


SKB

Exactly where should the filtraiton take place?

$
0
0

If a want to filtrate, not to make it accessable, a whole dimension table and some part of column in the dimension table for group or individual, exactly where and how should it take place in SSAS?

Difference between these two in deny permission

$
0
0

When you do some deny permission to get access to the data, why does SSAS has one cube and the rest is dimensional table before processing to make deny access. What is the different?

Processed cube sees no changes, but new data have been inserted..

$
0
0

Simple AdwWorks cube has time dimension with years range from 2000-th to 2007-th. Fact data exists for 2001-2006. 2000-th and 2007-th are empty.  Ok. 

I'm insert new data to source fact table for 2001-th  and process the cube. All changes immediately reflect in measure value (it grows). But new data for 2000-th don't reflect in measure value growing .  Nevertheless, during cube processing SSAS sees new rows for both cases (the value grows), and sql profiler catches equal batches of commands for  2001-th and 2000-th. But measure value grows only for 2001-th.

I've clear mdx-script - it contains now only calculate command. Now there is:

a) select sum(measure value) on fact tables in source database reflect new rows  for both cases

b) cube processing sees changes for both cases

c) mdx-script is clear (there are no scopes, witch can set measure value to null )

d) select [sales amount] for cube reflect this changes only for 2001-th, not for 2000-th

Any suggestions?

===========

One day later.. :)

The problem seems as resolved, but... I don't know: is it tech and/or logic feature or bug..

So, what is happened.. Simple mdx query:

select [sales amount] on 0,
[some date from 2000] on 1
from [cube]

gives null value for [sales amount], but for [some date from 2001] value is not empty. In database fact table both values (results of sum(salesamount) for both dates) are not empty. After research i found that there was one measure ([Temp]) in the [sales amount] measure group for which MeasureExpression was set to [sales amount]*[average rate] ([average rate] - measure from [Fact Currency Rate] measure group). Fact table for [Fact Currency Rate] measure group didn't contain data for 2000-th. I've insert it and - vualya - all work and for 2000-th now. Main question is: why ssas calculate MeasureExpression formulas for measures, which I'm not request in a query, and why ssas set requested by me value to null, if it does not depend from formula of MeasureExpression property of unrequested measure? Is it bug or "defense from fool"?. There is another sample of such strange ssas behaviour. I mean usage of UnaryOperatorColumn property. If it is set for any attribute of any dimension, then it influences on every query, even if this attribute not is a part of this query. For example

select [sales amount] on 0
from [cube]

returns different results, which depends by setting of UnaryOperatorColumn for some dimension attribute.. What all it mean?







executing mdx from sql server without linked server

$
0
0

Hi,

I want to execute a mdx query on sql server query window without using a linked server.

Can somebody guide me how can I do this .

Thanks in Advance.


Viewing all 14337 articles
Browse latest View live