Element filtering does not affect the total at facts with calculations in the SSAS cube

时间:2019-04-16 22:29:19

标签: sql-server ssas dax ssas-tabular

We have encountered a strange but explainable problem with calculations in our SSAS cube. To explain the problem we have cut off a little cube sample. We have a physical measure “revenue” witch came 1:1 from the Data Source. We put some logic in the calculation to subtract the credit amount from the invoice amount. The values are all in “revenue” the dimension separates the transaction types. That all works fine until we set en element filter on the dimension property “transaction type” we suggest the total result will be reduced by the filter but it is not affected as you can see in the screenshot.

The goal is that the filter we apply by excel affects the overall result too. By the way it’s not only excel, in SSMS it’s the same behavior.

Excel without filter: Excel without filter

After filtering “transaction type” and remove “Credit”, totals are still the same: after filtering the transaction type

In the cube calculation tab we make the following calculations:

CALCULATE;

(MEASUREGROUPMEASURES('revenues'),[Accounting component].[Transaction type].[All])
=
([Accounting component].[Transaction type].&[-], [Measures].CURRENTMEMBER)+
([Accounting component].[Transaction type].&[Invoice], [Measures].CURRENTMEMBER)-
([Accounting component].[Transaction type].&[Credit], [Measures].CURRENTMEMBER)-
([Accounting component].[Transaction type].&[Payment], [Measures].CURRENTMEMBER);

(MEASUREGROUPMEASURES('revenues'), [Accounting component].[Charge type].&[Agreed fees])
=
([Accounting component].[Transaction type].&[Invoice], [Measures].CURRENTMEMBER)-
([Accounting component].[Transaction type].&[Credit], [Measures].CURRENTMEMBER);

(MEASUREGROUPMEASURES('revenues'), [Accounting component].[Charge type].&[Fees collected])
=
([Accounting component].[Transaction type].&[Payment], [Measures].CURRENTMEMBER);

(MEASUREGROUPMEASURES('revenues'), [Accounting component].[Charge type].&[-])
=
([Accounting component].[Transaction type].&[-], [Measures].CURRENTMEMBER);

(MEASUREGROUPMEASURES('revenues'), [Accounting component].[Charge type].[All])
=
([Accounting component].[Charge type].&[Agreed fees], [Measures].CURRENTMEMBER)+
([Accounting component].[Charge type].&[-], [Measures].CURRENTMEMBER)-
([Accounting component].[Charge type].&[Fees collected], [Measures].CURRENTMEMBER);

In our test cube we have only one dimension and one fact: cube overview

The dimension itself has a hierarchy with two levels: dimension

As we understand, the [All] Element is not effected by the subcube query, but how we can achieve this behavior?

We have also tried to change the calculations to the "Unary Operators" function with the same result.

Do you have any idea to solve this?

0 个答案:

没有答案