Forum Discussion

niculeica's avatar
niculeica
Icon for Helper I rankHelper I
2 years ago
Solved

Metric Sum/Total does not add up correctly

Hi!

 

Having some issues with a metric that does not add up/sum up corretly in matrix. So I have Region, Client Name, Project Name (in this order) as rows, and the metric is below. On short, if Revenue Type is "Fixed Price", it's supposed to calulate Actual Revenue for Current Month minus Last month, else Actual Revenue for Current Month. It seems to be working only at Project Name level, while for Client Name and Region it bypasses the Revenue Type condition.

 

_Actual RR =
VAR CUR_MRank =
MAX('_Timeline Tasks'[_Month & Year Rank])
VAR CUR_RevenueType =
MAX('(Power BI) - Projects & Tasks - Mavenlink'[Revenue Type])
RETURN
IF(IF(CUR_RevenueType="Fixed Price",
CALCULATE(SUM('(Power BI) - Projects & Tasks - Mavenlink'[_Actual Revenue]),
FILTER('(Power BI) - Projects & Tasks - Mavenlink',
'(Power BI) - Projects & Tasks - Mavenlink'[_Month & Year Rank]=CUR_MRank))-
CALCULATE(SUM('(Power BI) - Projects & Tasks - Mavenlink'[_Actual Revenue]),
FILTER('(Power BI) - Projects & Tasks - Mavenlink',
'(Power BI) - Projects & Tasks - Mavenlink'[_Month & Year Rank]=CUR_MRank-1)),
CALCULATE(SUM('(Power BI) - Projects & Tasks - Mavenlink'[_Actual Revenue]),
FILTER('(Power BI) - Projects & Tasks - Mavenlink',
'(Power BI) - Projects & Tasks - Mavenlink'[_Month & Year Rank]=CUR_MRank)))=0,BLANK(),
IF(CUR_RevenueType="Fixed Price",
CALCULATE(SUM('(Power BI) - Projects & Tasks - Mavenlink'[_Actual Revenue]),
FILTER('(Power BI) - Projects & Tasks - Mavenlink',
'(Power BI) - Projects & Tasks - Mavenlink'[_Month & Year Rank]=CUR_MRank))-
CALCULATE(SUM('(Power BI) - Projects & Tasks - Mavenlink'[_Actual Revenue]),
FILTER('(Power BI) - Projects & Tasks - Mavenlink',
'(Power BI) - Projects & Tasks - Mavenlink'[_Month & Year Rank]=CUR_MRank-1)),
CALCULATE(SUM('(Power BI) - Projects & Tasks - Mavenlink'[_Actual Revenue]),
FILTER('(Power BI) - Projects & Tasks - Mavenlink',
'(Power BI) - Projects & Tasks - Mavenlink'[_Month & Year Rank]=CUR_MRank))))
 
 

 

Above, 52200 EUR is correct at Project Name level, while 261000 EUR is the correct total for when Revenue Type is skipped.

 

Any idea what's the reason? Thank you!

1 Reply