Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with Sum and variables

Hi,

I have the following sum which works:

=Num(sum({<[Year]={$(vCurrentYear)}>}[Hours Worked]*if(IsNull(Rate), 20, Rate)), '£#,##0;(£#,##0)')

What I can't figure out is to add the equivelent of an AND in.

=Num(Sum({<[Year]={$(vCurrentYear)}>} and If(Not([Project Status]='Admin'), [Hours Worked]*if(IsNull(Rate), 20, Rate))), '£#,##0;(£#,##0)')

I was thinking of something like the above, but that just gives a '-' in the result. Any help would be appreciated.

Thanks

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Didn't count the '(' and ')' 's. Try:

=Num(Sum({<[Year]={$(vCurrentYear)}, [Project Status] -={'Admin'}>} [Hours Worked]*if(IsNull(Rate), 20, Rate)), '£#,##0;(£#,##0)')


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

=Num(Sum({<[Year]={$(vCurrentYear)}, [Project Status] -={'Admin'}>} [Hours Worked]*if(IsNull(Rate), 20, Rate))), '£#,##0;(£#,##0)')


The expression editor doesn't know yet that -= is correct syntax, but that's a bug in the editor so don't worry about the red underlining.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert, pasted it in and it's showing '-', so that didn't work unfortunatly.

The editor didn't underlinethe -= , however, it did on the folling {

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Didn't count the '(' and ')' 's. Try:

=Num(Sum({<[Year]={$(vCurrentYear)}, [Project Status] -={'Admin'}>} [Hours Worked]*if(IsNull(Rate), 20, Rate)), '£#,##0;(£#,##0)')


talk is cheap, supply exceeds demand
Not applicable
Author

Perfect, thank you