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

help with expression

My requirement is if GetSelectedCount(Enrollment filter) is 0 ,I  should see default count values .I selected Enrollment Filter="New Enrollments", so my Disenrolled Field should show 0 , but instead its showing me Default count. I am using Following expression . but this is not working .

Please help!

Disenrolled calc:

if(GetSelectedCount(MonthYear)=0,
  if(GetSelectedCount([Enrollment Filter])=0,Count( {<[Disenrolled Indicator]={'Y'} ,[Date]={">$(varMinSelectedDate)<=$(varSelectedDate)"}>} [Recipient Identifier]),

      if([Enrollment Filter]='Enrollment',
       Count( {<[Disenrolled Indicator]={'Y'} ,[Date]={">$(varMinSelectedDate)<=$(varSelectedDate)"}>} [Recipient Identifier]),
               
               if([Enrollment Filter]='New Enrollments',
                0 ,
       
         if([Enrollment Filter]='Disenrollments',
     Count( {<[Disenrolled Indicator]={'Y'} ,[Date]={">$(varMinSelectedDate)<=$(varSelectedDate)"}>} [Recipient Identifier])
       
           )
         )
       )
  )
)

2 Replies
othniel2014
Contributor III
Contributor III

Change this

Count({<

  [Disenrolled Indicator]={'Y'} ,

  [Date]={">$(varMinSelectedDate)<=$(varSelectedDate)"}>}

[Recipient Identifier])

For this

Count({1<

  [Disenrolled Indicator]={'Y'} ,

  [Date]={$(='">= '& $(=varMinSelectedDate) & ' <= ' & $(=varSelectedDate) &'"')}

//or this

// [Date]={$(='">= '& $(varMinSelectedDate) & ' <= ' & $(varSelectedDate) &'"')}

>} Sales)

Or this

Count({<

  [Disenrolled Indicator]={'Y'} ,

  [Date]={$(='">= '& $(=varMinSelectedDate) & ' <= ' & $(=varSelectedDate) &'"')}

//or this

// [Date]={$(='">= '& $(varMinSelectedDate) & ' <= ' & $(varSelectedDate) &'"')}

>} Sales)

I use "Count({1<" for this ">= ## <= ##"

Edit:

if(GetSelectedCount(MonthYear)=0,

  if(GetSelectedCount([Enrollment Filter])=0,

  Count({1<[Disenrolled Indicator]={'Y'} ,[Date]={$(='">= '& $(varMinSelectedDate) & ' <= ' & $(varSelectedDate) &'"')}>}[Recipient Identifier]),

  if([Enrollment Filter]='Enrollment',

  Count({1<[Disenrolled Indicator]={'Y'} ,[Date]={$(='">= '& $(varMinSelectedDate) & ' <= ' & $(varSelectedDate) &'"')}>}[Recipient Identifier]),

  if([Enrollment Filter]='New Enrollments',

  0 ,

  if([Enrollment Filter]='Disenrollments',

  Count({1<[Disenrolled Indicator]={'Y'} ,[Date]={$(='">= '& $(varMinSelectedDate) & ' <= ' & $(varSelectedDate) &'"')}>}[Recipient Identifier])

  )

  )

  )

  )

)

Anonymous
Not applicable

Why dont you use,

if(GetSelectedCount(MonthYear)=0,

    

     if([Enrollment Filter]='New Enrollments',  0 ,


   Count( {<[Disenrolled Indicator]={'Y'} ,[Date]={">$(varMinSelectedDate)<=$(varSelectedDate)"}>} [Recipient Identifier])


))