简体   繁体   中英

How to use an excel cell on an MDX calculated measure?

We are using Excel to acces a SSAS Olap cube. We use some calculated measures defined on the excel sheet.

On one of them we need to use a user value entered on a specific cell.

Kind of

[Measures].[Sales]*$a$10

We cannot find any way to do it. Any idea?

Edit :

As it seems we cannot find a solution, we were thinking to create a new table with the valid values (it's a finite short list) and use them as a filter, so we could use the value on the formula. I cannot imagine how to do that, because it would be a table not related to any other table in the cube ... Does this make any sense?

Edit : solved, see below.

hahahahahah .... this is probably the craziest idea I had since a long time ... but it works!

We just created an Excel macro!! that rebuilds the calculated measure when the specified cell changes:

ActiveWorkbook.Connections( _
    "MyHost MyOLAP MyCube").OLEDBConnection. _
    CalculatedMembers("[Measures].[MyFormula]").Delete
ActiveWorkbook.Connections( _
    "MyHost MyOLAP MyCube").OLEDBConnection. _
    CalculatedMembers.AddCalculatedMember Name:="[Measures].[MyFormula]", _
    Formula:=Array("[Measures].[Sales]*" & Range("d1").Value), _
    Type:=xlCalculatedMeasure,SolveOrder:=0, ParentHierarchy:= _
    "[Measures]", NumberFormat:=xlNumberFormatTypeDefault
ActiveSheet.PivotTables("MyPivotTable").RefreshTable

:) :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM