Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 Ian_Diniz
		
			Ian_Diniz
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 
					
				
		
 Mark_Little
		
			Mark_Little
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
		
			EdgarOlmos
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
You can use an expression like this.
Sum(AnoMes= {"<=$(=max([FechamentoEngagement]))"} [ValorDespesasEngagementAcum])
Regards
 Ian_Diniz
		
			Ian_Diniz
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
