Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts

Wednesday, March 7, 2012

call excel function - xIRR from the report

Hi,
I need to call an excell function, xIRR, from my report.
How can I do that?

Thanks,

Igor

Hi Igor,

This is a great feature request for a later release that is already on our list. Excel functions, like you intend to use, are not currently supported.

|||

Igor,

You could write your own custom xIRR function and use it in your report.

Jarret

|||

Here is something you could try assuming you have Excel installed on the server.

1. Create a .NET library assembly

2. Reference the Excel object model - COM tab, Microsoft Office Excel x.0 Object Library. This will create P/Invoke wrapper on top of the Excel function dll.

3. Try calling the Excel function you need. They are under Microsoft.Office.Interop.Excel.IWorksheetFunction namespace.

Call DTS package from VBA/Excel?

Can you call a DTS package using VBA (specifically from Excel). I would like
to have a command button to launch a DTS package that extracts data from the
spreadsheet to SQL Server. Today I have to open up Enterprise Manager to do
this.

Any code examples would be great too if this is possible.

Thanks,
ChadLook up "Executing DTS Packages in Visual Basic" in Books online or on
the Microsoft website.

-Tom.

Friday, February 24, 2012

Calculations in a subcube world

I'm having trouble getting my calculations to work with query tools that use subcubes in the WHERE clause instead of a normal slicer. Both Excel 2007 and SSRS (when using the query designer) use this technique.

This is an example of a calculation:

CREATE MEMBER CURRENTCUBE.[MEASURES].[YTD]

AS SUM(

PERIODSTODATE([Time].[Y-Q-M-D].[Year],

[Time].[Y-Q-M-D].CurrentMember),

[Measures].CurrentMember),

FORMAT_STRING = "#,#",

VISIBLE = 1;

A typical query through Excel 12 will use the following MDX to filter when selecting March 2006 from a time hierarchy:

..FROM (SELECT ({[Time].[Y-Q-M-D].[Quarter].&[2006]&[1]}) ON COLUMNS FROM [Datawarehouse])

Instead of the old-fashioned

WHERE([Time].[Y-Q-M-D].[Quarter].&[2006]&[1])

When querying for March 2006 filtered by a subcube the mentioned calculated member will return NULL, when hand crafting the query using the WHERE construct, it will return the expected results.

Running a select through Excel 2007 with the filter and the following test member makes the problem obvious:

CREATE MEMBER CURRENTCUBE.[MEASURES].[test]

AS [Time].[Y-Q-M-D].CurrentMember.Name,

VISIBLE = 1;

The .CurentMember of the Y-Q-M-D hierarchy is the All member when a subcube is used, not the actual member(s) in the filter.

Can anyone advice me on how to formulate my calculations so they work with subcubes?

Hi Peter

This is a known issue. Please see the following blog entry for an elaboration.

http://www.sqljunkies.com/WebLog/reckless/archive/2006/03/08/18601.aspx

Calculations in a subcube world

I'm having trouble getting my calculations to work with query tools that use subcubes in the WHERE clause instead of a normal slicer. Both Excel 2007 and SSRS (when using the query designer) use this technique.

This is an example of a calculation:

CREATE MEMBER CURRENTCUBE.[MEASURES].[YTD]

AS SUM(

PERIODSTODATE([Time].[Y-Q-M-D].[Year],

[Time].[Y-Q-M-D].CurrentMember),

[Measures].CurrentMember),

FORMAT_STRING = "#,#",

VISIBLE = 1;

A typical query through Excel 12 will use the following MDX to filter when selecting March 2006 from a time hierarchy:

..FROM (SELECT ({[Time].[Y-Q-M-D].[Quarter].&[2006]&[1]}) ON COLUMNS FROM [Datawarehouse])

Instead of the old-fashioned

WHERE([Time].[Y-Q-M-D].[Quarter].&[2006]&[1])

When querying for March 2006 filtered by a subcube the mentioned calculated member will return NULL, when hand crafting the query using the WHERE construct, it will return the expected results.

Running a select through Excel 2007 with the filter and the following test member makes the problem obvious:

CREATE MEMBER CURRENTCUBE.[MEASURES].[test]

AS [Time].[Y-Q-M-D].CurrentMember.Name,

VISIBLE = 1;

The .CurentMember of the Y-Q-M-D hierarchy is the All member when a subcube is used, not the actual member(s) in the filter.

Can anyone advice me on how to formulate my calculations so they work with subcubes?

Hi Peter

This is a known issue. Please see the following blog entry for an elaboration.

http://www.sqljunkies.com/WebLog/reckless/archive/2006/03/08/18601.aspx

Sunday, February 19, 2012

Calculation with Excel rendred values

We have a problem with Excel rendering. The target of Excel rendering should
be, that end users could use the rendered values for further calculations.
But, independent of the format of the values, we assigned within the report,
all cells have to be converted manually after excel rendering in order to be
able to use them for calculations. Where are we wrong?We are having the same problem when exporting to Excel. We're formatting our
cells using the following: #,##0.00;(#,##0.00)
The reason for this format is to show the numbers without the currency
symbol. Unfortunately, when we use this format Excel interprets it as text
instead of a specific number format. Like you, we have to manually convert
the cells to numbered formats to use them for calculations.
"Niklas" wrote:
> We have a problem with Excel rendering. The target of Excel rendering should
> be, that end users could use the rendered values for further calculations.
> But, independent of the format of the values, we assigned within the report,
> all cells have to be converted manually after excel rendering in order to be
> able to use them for calculations. Where are we wrong?

Friday, February 10, 2012

Calculated Members slow to display in Excel PivotTable

Hi,

I have created an Analysis Services 2005 cube, and am viewing it using an Excel PivotTable. When using Excel 2003, normal members display instantly, but when I place a calculated member in the PivotTable's data area it sits for several minutes before displaying. The calculated member (Gross Margin Percentage) was created with the expression:

[Measures].[Gross Margin]/[Measures].[Net Sale]

Net Sale is a data field from the Data Source View, while Gross Margin is a named calculation in the Data Source View (with the expression NetSale - Cost). When I use Excel 2000 the calculated member processes quickly. I cannot see any other option to give a percentage measure in the PivotTable, as I'm assuming that if I specify Gross Margin Percentage in the Data Source View it will not be aggregated correctly. Does anyone have any idea why Excel 2003 would give the slow performance, and whether there is any alternative way around it?

Thanks, Matt

Actually I prefer calculating the fields in a query and creating the cube using that query. Still slow? Create an index for that query Still slow? create a table. :) Hope it is MOLAP.|||

Hi, thanks for your response. The cube is fairly standard, being based on a few tables in my data warehouse. It is MOLAP. The reason I don't wish to calculate the Percentage field in a query is that the percentages will be aggregated incorrectly. For example if I had two records in the query as below:

Sales Margin MarginPercentage

10 5 0.5

20 5 0.25

Total 30 10 0.75

So as you can see the total margin percentage will give 0.75 when it should give 0.33. This is why I am using a calculated member in the cube rather than calculating the percentage within a query. I am wanting to know why this calculated member processes the same as all other members in Excel 2000, but is slow in Excel 2003. And also if there is anything I can do to get around the problem?

Thanks in advance, Matt

|||Nothing I can say. Ask the developpers of Excel 2003. :)|||

Did anyone tried with Excel 2007 ?

Philippe

|||

Could you please use Profiler to trace the MDX queries executed by Excel 2000, respectively Excel 2003, to understand the different between the queries?

Thank you

|||

A couple of thoughts:

i. Have you configured Non Empty Behaviour for the measure?

ii. I've had some problems with Excel 2003 hanging waiting for a query off a pivot table to execute. If I run the profiler and capture the MDX it still runs in a few seconds from BIDS. I'm guessing this particular issue is in the data transport layer because I get the same issue with ProClarity.

NWC

CALCULATED MEMBERS IN EXCEL 2000

I have created a cube that uses "calculated members" for %
calcs.
The data has processed fine on the SLQSERVER 2000 Analysis
server.
Using Excel 2000 I tried to build a Pivot Table using
the "calculated members" by connecting to the OLAP cube.
Although the summarised fields appear okay,
the "calculated members" do not although they are
available on the filtering list.
"calculated members" do appear to work in Excel 2002 and
Excel 2003.
Can someone please explain why "calculated members" do not
appear in Excel 2000.
Thanks
SH
Excel 2000 only supports calculated members in the measures, e.g.
[Measures].[calcname]
It does not support calculated member in one of the dimensions . . . is this
where you are trying to create it?
Excel 2002 and later do support calculated members in dimensions.
Dave Wickert [MS]
dwickert@.online.microsoft.com
Program Manager
BI Practices Team
SQL BI Product Unit (Analysis Services)
This posting is provided "AS IS" with no warranties, and confers no rights.
"SH" <anonymous@.discussions.microsoft.com> wrote in message
news:e1f201c43c24$93764f30$a501280a@.phx.gbl...
> I have created a cube that uses "calculated members" for %
> calcs.
> The data has processed fine on the SLQSERVER 2000 Analysis
> server.
> Using Excel 2000 I tried to build a Pivot Table using
> the "calculated members" by connecting to the OLAP cube.
> Although the summarised fields appear okay,
> the "calculated members" do not although they are
> available on the filtering list.
> "calculated members" do appear to work in Excel 2002 and
> Excel 2003.
> Can someone please explain why "calculated members" do not
> appear in Excel 2000.
> Thanks
> SH
>
|||Thanks for the reply.
Yes I've set it up against the dimension.
Is there any workarounds?
Best Regards
Sunny Scotland
>--Original Message--
>Excel 2000 only supports calculated members in the
measures, e.g.
>[Measures].[calcname]
>It does not support calculated member in one of the
dimensions . . . is this
>where you are trying to create it?
>Excel 2002 and later do support calculated members in
dimensions.
>--
>Dave Wickert [MS]
>dwickert@.online.microsoft.com
>Program Manager
>BI Practices Team
>SQL BI Product Unit (Analysis Services)
>--
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>
>"SH" <anonymous@.discussions.microsoft.com> wrote in
message[vbcol=seagreen]
>news:e1f201c43c24$93764f30$a501280a@.phx.gbl...
for %[vbcol=seagreen]
Analysis[vbcol=seagreen]
not
>
>.
>

CALCULATED MEMBERS IN EXCEL 2000

I have created a cube that uses "calculated members" for %
calcs.
The data has processed fine on the SLQSERVER 2000 Analysis
server.
Using Excel 2000 I tried to build a Pivot Table using
the "calculated members" by connecting to the OLAP cube.
Although the summarised fields appear okay,
the "calculated members" do not although they are
available on the filtering list.
"calculated members" do appear to work in Excel 2002 and
Excel 2003.
Can someone please explain why "calculated members" do not
appear in Excel 2000.
Thanks
SHExcel 2000 only supports calculated members in the measures, e.g.
[Measures].[calcname]
It does not support calculated member in one of the dimensions . . . is this
where you are trying to create it?
Excel 2002 and later do support calculated members in dimensions.
--
Dave Wickert [MS]
dwickert@.online.microsoft.com
Program Manager
BI Practices Team
SQL BI Product Unit (Analysis Services)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"SH" <anonymous@.discussions.microsoft.com> wrote in message
news:e1f201c43c24$93764f30$a501280a@.phx.gbl...
> I have created a cube that uses "calculated members" for %
> calcs.
> The data has processed fine on the SLQSERVER 2000 Analysis
> server.
> Using Excel 2000 I tried to build a Pivot Table using
> the "calculated members" by connecting to the OLAP cube.
> Although the summarised fields appear okay,
> the "calculated members" do not although they are
> available on the filtering list.
> "calculated members" do appear to work in Excel 2002 and
> Excel 2003.
> Can someone please explain why "calculated members" do not
> appear in Excel 2000.
> Thanks
> SH
>|||Thanks for the reply.
Yes I've set it up against the dimension.
Is there any workarounds'
Best Regards
Sunny Scotland
>--Original Message--
>Excel 2000 only supports calculated members in the
measures, e.g.
>[Measures].[calcname]
>It does not support calculated member in one of the
dimensions . . . is this
>where you are trying to create it?
>Excel 2002 and later do support calculated members in
dimensions.
>--
>Dave Wickert [MS]
>dwickert@.online.microsoft.com
>Program Manager
>BI Practices Team
>SQL BI Product Unit (Analysis Services)
>--
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>
>"SH" <anonymous@.discussions.microsoft.com> wrote in
message
>news:e1f201c43c24$93764f30$a501280a@.phx.gbl...
for %[vbcol=seagreen]
Analysis[vbcol=seagreen]
not[vbcol=seagreen]
>
>.
>

Calculated members are unbelievably slow

In general. Need help what are the top items I must check? My client is Excel Pivot table

I have one cal. member [NAV] from one fact table I am getting POSN TOTL CURR NAV BAL PTFC and OWNSHP PRCNTG

cal. mem [NAV] formula is below

Iif(([Investment].CurrentMember.Level.Name = "Investment Cd" or

[Investment].CurrentMember.Level.Name="Investment Type Cd") and

([Investor].CurrentMember.Level.Name="Investor Type Cd" or

[Investor].CurrentMember.Level.Name="Investor Cd" or

[Investor].CurrentMember.Level.Name="Investor Desc") ,

[Measures].[POSN TOTL CURR NAV BAL PTFC] * [Measures].[OWNSHP PRCNTG] ,

Iif([Investment].CurrentMember.Level.Name="Investment Cd" or

[Investment].CurrentMember.Level.Name="Investment Type Cd" ,

[Measures].[POSN TOTL CURR NAV BAL PTFC] ,

Iif(([Investor].CurrentMember.Level.Name="Investor Type Cd" or

[Investor].CurrentMember.Level.Name="Investor Cd" or

[Investor].CurrentMember.Level.Name="Investor Desc") ,

[Measures].[POSN TOTL CURR NAV BAL FUND] ,

Sum({[Investor].AllMembers}, [Measures].[POSN TOTL CURR NAV BAL FUND]))))

and hand full of simple calculations like this from different fact table

[Measures].[EQ UP 5P]/[Measures].[NAV]

Thank you - Ashok

Couple of suggestions:

1. Get rid of all IIF's and replace them with SCOPE as explained here: http://www.sqljunkies.com/WebLog/mosha/archive/2007/01/28/iif_performance.aspx

2. Revisit whether Sum({[Investor].AllMembers}, [Measures].[POSN TOTL CURR NAV BAL FUND])) is even correct. I think it isn't. It tries to sum up members from all levels of Investor dimension. This cannot be right. Also, it is going to be constant regardless of the current coordinate in Investor dimension, even though the rest of your expression carefully looks at the current coordinate in Investor.

|||

Thanks Mosha,

Because I have more then one IIF and I am new to MDX can I replace my NAV MDX with this ?

SCOPE (([Investment].CurrentMember.Level.Name = "Investment Cd" or [Investment].CurrentMember.Level.Name="Investment Type Cd")
and ([Investor].CurrentMember.Level.Name="Investor Type Cd" or [Investor].CurrentMember.Level.Name="Investor Cd"
or [Investor].CurrentMember.Level.Name="Investor Desc"));
This = [Measures].[POSN TOTL CURR NAV BAL PTFC] * [Measures].[OWNSHP PRCNTG];
SCOPE ([Investment].CurrentMember.Level.Name="Investment Cd" or [Investment].CurrentMember.Level.Name="Investment Type Cd");
This = [Measures].[POSN TOTL CURR NAV BAL PTFC];
SCOPE ([Investor].CurrentMember.Level.Name="Investor Type Cd" or [Investor].CurrentMember.Level.Name="Investor Cd" or
[Investor].CurrentMember.Level.Name="Investor Desc"));
This = [Measures].[POSN TOTL CURR NAV BAL FUND];
SCOPE ([Investor].AllMembers)
This = [Measures].[POSN TOTL CURR NAV BAL FUND];
END SCOPE;

Thank you - Ashok

I just tried this and I am getting syntax error

CREATE MEMBER CURRENTCUBE.[MEASURES].[NAV]

AS SCOPE ([Investor].AllMembers);

This = [Measures].[POSN TOTL CURR NAV BAL PTFC] * [Measures].[OWNSHP PRCNTG];

END SCOPE;,

VISIBLE = 1 ;

|||

Looks like you are still learning the syntax of MDX scripts. Here are two resources which have examples of how to convert IIF to SCOPE:

1. AS2005 Performance Guide http://download.microsoft.com/download/8/5/e/85eea4fa-b3bb-4426-97d0-7f7151b2011c/SSAS2005PerfGuide.doc. (look for the MDX optimization section)

2. This blog also has an example: http://www.sqljunkies.com/WebLog/mosha/archive/2006/11/05/non_empty_behavior.aspx