Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 18056

Total sum of a column calcuated NOT CORRECT (using function TOTALYTD; SAMEPERIODLASTYEAR: etc.)

$
0
0

Hi PBI Community,

I'm new with PBI, and I need an help to fix an issue I have, and that I'm not able to solve.

I'm creating an analysis that calculate the:

 

Sales current year: SalesCY= TOTALYTD(sum(Consolidated[Sales]); DATE[Date])

Sales previous year: SalesPY = CALCULATE(Consolidated[SalesCY]; SAMEPERIODLASTYEAR(DATE[Date]))

 

then I have calculated the quantity with the same functions used for the sales:

 

Quantity current year: QuantityCY= TOTALYTD(sum(Consolidated[Quantity]); DATE[Date])

Quantity preiovus year: QuantityPY = CALCULATE(Consolidated[QuantityCY]; SAMEPERIODLASTYEAR(DATE[Date]))

 

At this point I have calculated the Price unit, divinding the

 

Price unit CY = Sales CY / Quantity CY

Price unit PY = Sales PY / Quantity PY

 

and then

 

Delta Price unit = Price unit CY - Price unit PY

Mix = Delta Price unit * Quantity CY

 

I'm arriving to the problem: If I create a Table using a Matrice that has in row

Customer / Part number and in Columns the measure "Mix", what it can be noticed is that the calculation at Part number level is correct, but the total of the column "Mix" is "wrong" , as the screen that folllows:

 

image.png

The final sum is 40.474 insted of 36.451. In grey is the calculation of the Mix measure at Part numer level. In blank the sum that should be at the customer level. 

 

How can I fix it? Why does it work wrong?

Thanks in advance for the help!


Viewing all articles
Browse latest Browse all 18056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>