Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
muhammadasfand
Contributor II
Contributor II

Error in Expression ')' expected

I am using below expression for a count calculation, i have not missed any ')' and expression is working on some filters and throwing 'Error in expression ')'  in some cases, no idea on which basis

Here is the expression

Count(distinct if(Year=$(vLastYear) and Date <= $(vLastYTD) and (SubFlag = 'Custom_Req'  or SubFlag = 'Terminal_Req') and Flag_Filter = '0',VOYAGE_KEY1))

Any suggestions please?

Thanks,

Labels (2)
6 Replies
ahmetozsari
Contributor
Contributor

Hi,

Try this.

=Count(distinct if(Year=$(vLastYear) and Date <= '$(vLastYTD)' and
(SubFlag = 'Custom_Req' or SubFlag = 'Terminal_Req') and Flag_Filter = '0',VOYAGE_KEY1))

mdmukramali
Specialist III
Specialist III

Hi,

 

can you try with Set Analysis:

=Count(

{<Year={'$(vLastYear) '},Date={"<$(vLastYTD)"},SubFlag ={'Custom_Req','Terminal_Req'},Flag_Filter ={0}>}

Distinct VOYAGE_KEY1)

Thanks,

Mohammed Mukram

muhammadasfand
Contributor II
Contributor II
Author

Tried, it does not consider Date after applying and give full Year count, also after applying that error is still coming.

muhammadasfand
Contributor II
Contributor II
Author

Tried, it does not consider Date after applying and give full Year count, also after applying that error is still coming.
muhammadasfand
Contributor II
Contributor II
Author

@Mukram, In Set Analysis Date filter was not getting applied with
Date={"<$(vLastYTD)"} or Date={'<$(vLastYTD)'} and returning 0 so thats why i switched to if condition, if set analysis works with Date filter then it is best.

Thanks,
mdmukramali
Specialist III
Specialist III

Hi,

 

can you attach sample file.