Forum Discussion

Krcmajster's avatar
Krcmajster
Helper IV
4 years ago
Solved

Totals completely incorrect

I am having a strange behaviour in Power BI. Below screenshot will summarize it. The total is not even close to what it should be based on the values above. 

Below is the summary of the calculation
there are 2 tables Sales and Percentage, with one (sales) o many relationship, one directional. 
I have below calculation

Percentage per Sales =
DIVIDE(DIVIDE(SUM ( 'Percentage'[Percent] ) , COUNTROWS ( Sales )),100)

and 

Amount= SUMX('Sales', 'Sales'[Amount]) * [Percentage per Sales]
 
Amount of each sales can be split by percentage, that is why I need the calculation.
So Sales ID 100 can have amount of 10,000, and there are percentages of 20 and 40. Which would mean that my calculation needs to be 10,000*0.2=2,000 and 10,000*0.4=4,000, so the total for Sales ID 100 is 6,000. Which I achieved with Percentage per Sales measure, but the totals are incorrect in table or cards.
  • Krcmajster , Try a measure like


    Amount= SUMX(values('Sales'[ID]), calculate(sum('Sales'[Amount]) * [Percentage per Sales]))

1 Reply

  • Krcmajster , Try a measure like


    Amount= SUMX(values('Sales'[ID]), calculate(sum('Sales'[Amount]) * [Percentage per Sales]))