COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: kpagel on 11 Jun 2019 03:51:22 PM

Title: Date Range Expression
Post by: kpagel on 11 Jun 2019 03:51:22 PM
I have created a Query Calculation to total ([dms].[inv].[tot_net_amt]). However, I only want it to total that value if [dms].[inv].[trans_date] is during a given calendar year (i.e., 2018, 2019, etc.). What is the best approach to create this expression?
Title: Date Range Expression
Post by: kpagel on 11 Jun 2019 03:51:40 PM
I have created a Query Calculation to total ([dms].[inv].[tot_net_amt]). However, I only want it to total that value if [dms].[inv].[trans_date] is during a given calendar year (i.e., 2018, 2019, etc.). What is the best approach to create this expression?
Title: Re: Date Range Expression
Post by: CognosPaul on 11 Jun 2019 11:27:09 PM
easiest way would be to do total(case when [dms].[inv].[trans_date]  in (2018, 2019) then [dms].[inv].[tot_net_amt] else 0 end )