Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Ian_Diniz
Partner - Contributor
Partner - Contributor

Set analysis with a dynamic

Hello, everyone! 
I'm currently struggling with a conditional and a set expression for my app, the TLDR is: I'm looking at the selected date (AnoMes) in the filter pane, if this date is less than, or equal the date of closing (FechamentoEngagement), use the max AnoMes in the filter.

The problem lies on the else part, in here i need to get the date (FechamentoEngagement) for each row in the app, that is distinc one to another, and use it as the 

 

if(GetSelectedCount(AnoMes)>0,
       if(Max(AnoMes) <= FechamentoEngagement,
                  Sum({<AnoMes={'$(=Max(AnoMes))'}>}[ValorDespesasEngagementAcum]),
                  Sum({<AnoMes=FechamentoEngagement>}[ValorDespesasEngagementAcum]) // in this line the result I'm looking for is the sum of ValorDespesasEngagementAcum in the date until FechamentoEngagement
),
       Sum({<AnoMes={'$(vAnoMesFechado)'}>}[ValorDespesasEngagementAcum])
)

 

With this, i'm getting 0 as a result for the second if when the AnoMes > FechamentoEngagement, because in the dataset this values are 0 for performance gain

Labels (1)
3 Replies
Mark_Little
Luminary
Luminary

Hi @Ian_Diniz 

Can you flip the Set expression as AnoMes is the where you are trying to get the sub set of values from and comparing to a single FechamentoEngagement something like 

{<FechamentoEngagement = {'$(=Max(AnoMes))'}>}

EdgarOlmos
Contributor III
Contributor III

Hi

You can use an expression like this.

Sum(AnoMes= {"<=$(=max([FechamentoEngagement]))"} [ValorDespesasEngagementAcum])

Regards

Ian_Diniz
Partner - Contributor
Partner - Contributor
Author

The field FechamentoEngagement isnt ordered, neither respect any kind of rule. Every engagement have a distinct FechamentoEngagement and this might be the reason to whenever the app gets 2 or more Engagements or dates filtered, the sum returns some weird values