Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
bhaveshp90
Creator III
Creator III

Expression is not working

Hello, 

I've the sample test table as shown below1.PNG

 

My MTD total -427,884 is correct as shown above (with selected Cost_Code = 3), When I create another expression with  Cost_Code =3 in the set analysis, the total is incorrect as highlighted above. 

What is wrong in my "Cost_Code=3" expression? attached is the file for reference. 

Aggr(If(Only({1} Country_Name) = Above(TOTAL Only({1} Country_Name)),
If(Num_Month_Project_Cost = '$(vPreYearLastMonth)' and Year = '$(vPreYear)', 
0,
(If(Num_Month_Project_Cost = '$(vPreYearLastMonth)' and Year = '$(vPreYear)', 0, Sum(TOTAL<Region1,Country_Name>{<Cost_Code={3}>}Updated_OEC_Budget_USD)))
-
(If(Num_Month_Project_Cost = '$(vPreYearLastMonth)' and Year = '$(vPreYear)', 0, Sum(TOTAL<Region1,Country_Name>{<Cost_Code={3}>}Forecast_Cost_to_Complete_USD)))
-
(
Sum(TOTAL<Region1,Country_Name>{<Cost_Code={3}>}Prior_Updated_OEC_Budget_USD)
-
Sum(TOTAL<Region1,Country_Name>{<Cost_Code={3}>}Prior_Forecast_Cost_to_Complete_USD)
))
- 
Alt(Above(TOTAL
If(Only({<MonthYear,Snapshot_Date>}Num_Month_Project_Cost) = '$(vPreYearLastMonth)' and Only({<MonthYear, Snapshot_Date>}Year) = '$(vPreYear)', 
	0,
	(If(Only({<MonthYear,Snapshot_Date>}Num_Month_Project_Cost) = '$(vPreYearLastMonth)' and Only({<MonthYear, Snapshot_Date>}Year) = '$(vPreYear)', 0, Sum({<MonthYear, Snapshot_Date, Cost_Code={3}>}Updated_OEC_Budget_USD)))
	-
	(If(Only({<MonthYear,Snapshot_Date>}Num_Month_Project_Cost) = '$(vPreYearLastMonth)' and Only({<MonthYear,Snapshot_Date>}Year) = '$(vPreYear)', 0, Sum({<MonthYear, Snapshot_Date, Cost_Code={3}>}Forecast_Cost_to_Complete_USD)))
	- 
	((Sum({<MonthYear,Snapshot_Date,Cost_Code={3}>}Prior_Updated_OEC_Budget_USD))	
	-
	Sum({<MonthYear, Snapshot_Date,Cost_Code={3}>}Prior_Forecast_Cost_to_Complete_USD)))
),0),
	If(Num_Month_Project_Cost = '$(vPreYearLastMonth)' and Year = '$(vPreYear)', 0,
	(If(Num_Month_Project_Cost = '$(vPreYearLastMonth)' and Year = '$(vPreYear)', 0, Sum(TOTAL<Region1,Country_Name>{<Cost_Code={3}>}Updated_OEC_Budget_USD)))
	-
	(If(Num_Month_Project_Cost = '$(vPreYearLastMonth)' and Year = '$(vPreYear)', 0, Sum(TOTAL<Region1,Country_Name>{<Cost_Code={3}>}Forecast_Cost_to_Complete_USD)))
	-
	(
	(Sum(TOTAL<Region1,Country_Name>{<Cost_Code={3}>}Prior_Updated_OEC_Budget_USD)
	-
	Sum(TOTAL<Region1,Country_Name>{<Cost_Code={3}>}Prior_Forecast_Cost_to_Complete_USD))
	))
), Country_Name,MonthYear,Region1)

thanks

Bhavesh

Labels (3)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

2 Replies
sunny_talwar
MVP
MVP

Check attached

bhaveshp90
Creator III
Creator III
Author

You are Awesome man Smiley Happy, thank you so much @sunny_talwar