Forum Discussion
LeaRupnik
Helper III
5 years agoexemple sum
Hello, i have a problem, with sum and thant vhat a have too give in a table in powerBI. I have a formula in SSAA: PLAN NAB PREMIJA VRED:=CALCULATE([SumPlan_nab_premija]*[SumPlan_kol]/1000; F...
d_gosbell
Super User
5 years agoThis sounds like an order of operations issue. Currently the code is summing the two measures, then doing the multiplication and division and it sounds like you want it to do the multiplication and division first then sum up the results.
You could achieve this by doing a SUMX over the values in [Sistem naziv enote] (assuming that is the lowest level that you want the values calculated at)
eg.
REAL NAB PREMIJA VRED v2 =
var maxDatum = MAX('fact (2)'[datum_posnetka])
return CALCULATE(
SUMX( VALUES('fact (2)'[Sistem naziv enote]),
[SumReal_nab_premija]*[REAL NAB KOL]/1000)
, 'fact (2)'[datum_posnetka] = maxDatum )