我正在尝试编写一个公式,根据报告期(varchar)为我提供基本交易金额(Int)
因此,如果报告期为201803,则表达式应计算该期是否大于去年同月201701或小于去年下月201702,或是否介于今年的01和02之间,依此类推。
我得出了以下公式,但没有给我一个错误,但当我运行包时,我在派生列中得到了0,而它应该是基本交易金额。
PrevYear01列:(ReportingPeriod>=“Year(getdate()-1)”+“01”)&&(报告期<“年(getdate()-1)”+“02”)?BaseTransactionAmount:0
ThisYear01列:(ReportingPeriod>=“Year(getdate())”+“01”)&&(ReportingPeriod<“Year(getdate())”+“02”)?BaseTransactionAmount:0
请帮忙!