Smells like a hidden subselect. Declare a dynamic set of
[Artikal].[Artikalid].[Artikalid] and use it in the measure instead.
Total Sum of Calculated member is wrong

I have there tables:
- Artikal (eng. Item)
- Grupa (eng. Group)
- Potrosnja (eng. Consumption)
Based on this tables I created OLAP Cube. I have Measure Potrosnja and two dimensions: Artikal and Time. Artikal dimension is joined with Grupa table so we can create
Hierarchy:
Hierarchy: Grupa.ParentId, Grupa.GrupaId, Artikal.Id. Name of Hierarhcy is PGA.
This shows well in Power BI. I also create some calculated Members: Cijena LY and Vrijednost LY.
I need to create a calculated member and the formula goes
(Cijena - Cijena LY)* Kolicina
First I tried to create like a calculated member but I saw that my total was also creating like the formula of totals of formulas. I want that my total for this member is SUM of calculated member column
I trying to do this with SCOPE, but I don't get the right result. Here is my script:
CREATE MEMBER CURRENTCUBE.[Measures].[Suma razlike] AS null,
VISIBLE = 1;
SCOPE([Measures].[Suma razlike],[Artikal].[PGA].members);
This =sum(
Descendants([Artikal].[PGA].CurrentMember,,LEAVES),
(([Measures].[Cijena]-[Measures].[Cijena LY])*[Measures].[Kolicina]));
END SCOPE;
Can somebody tell me what I am doing wrong? I creating this in Analysis services by Microsoft.
-
Alexei Stoyanovsky 3,326 Reputation points
2021-09-13T15:05:20.493+00:00