COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: que1983 on 17 Mar 2016 02:21:53 PM

Title: If statement and count not working
Post by: que1983 on 17 Mar 2016 02:21:53 PM
if([Presentation Layer].[CORRESPONDENT PENDS].[Pend Description] not like 'XINTR%' then
count([Presentation Layer].[PIPELINE POST FINAL ACTION].[Loan Number])

I am getting this error failed to load report specification query not allowed in query service.  I want to do a count only if the above description is not like XINTR
Title: Re: If statement and count not working
Post by: BigChris on 18 Mar 2016 02:51:17 AM
You could try an alternative approach is that isn't working:

total( if([Presentation Layer].[CORRESPONDENT PENDS].[Pend Description] starts with 'XINTR') then (0) else (1))
Title: Re: If statement and count not working
Post by: MFGF on 22 Mar 2016 08:59:34 AM
Quote from: que1983 on 17 Mar 2016 02:21:53 PM
if([Presentation Layer].[CORRESPONDENT PENDS].[Pend Description] not like 'XINTR%' then
count([Presentation Layer].[PIPELINE POST FINAL ACTION].[Loan Number])

I am getting this error failed to load report specification query not allowed in query service.  I want to do a count only if the above description is not like XINTR

You appear to be missing some parentheses and an else clause in this expression. Have you tried:

if([Presentation Layer].[CORRESPONDENT PENDS].[Pend Description] not like 'XINTR%') then
(count([Presentation Layer].[PIPELINE POST FINAL ACTION].[Loan Number])) else (null)

MF.