Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
joshrussin
Creator III
Creator III

Monthly result

The attached expression gives me the correct result of monthly gains/losses when a specific area is chosen in a filter. When none or all are selected I get an unknown number.

=(Sum({$<Date_Dash={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}, Status_Dash={'Completed'}>} Processed_Dash - Daily_Target_Dash))

*

(sum({$<Date_Dash={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}, Status_Dash={'Completed'}>}Ave_Cost_Dash))

vHolidays is a variable to account for holidays

data.PNG

I am trying to get the results in a text box.

The correct result when nothing or all are clicked should be "-3,188.95", I am actually getting "-8,240,678"

1 Solution

Accepted Solutions
sunny_talwar

Try this

=Sum(Aggr(

(Sum({$<Date_Dash={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}, Status_Dash={'Completed'}>} Processed_Dash - Daily_Target_Dash))

*

(sum({$<Date_Dash={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}, Status_Dash={'Completed'}>}Ave_Cost_Dash))

,Date_Dash, Program_Dash, Status_Dash))

View solution in original post

3 Replies
sunny_talwar

Try this

=Sum(Aggr(

(Sum({$<Date_Dash={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}, Status_Dash={'Completed'}>} Processed_Dash - Daily_Target_Dash))

*

(sum({$<Date_Dash={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}, Status_Dash={'Completed'}>}Ave_Cost_Dash))

,Date_Dash, Program_Dash, Status_Dash))

joshrussin
Creator III
Creator III
Author

Thanks Sunny! That works

Can you explain to me how the aggr function is working here? I haven't used this one yet.

sunny_talwar

Aggr() function is used for various reasons, but one of those is to get the sum of rows. So based on your chart, I think you wanted to get the sum of rows. So I used your expressions and wrapped it around with the Sum(Aggr())...

Sum(Aggr(Expression, ChartDimensionsSeparatedByComma))