4 Replies Latest reply: Nov 26, 2013 4:10 PM by Raghuram Rao

# Question Expression  Syntax

I have two Data Elements - Bkg_Yr, Bkg_Mth which User can select on.  I have a third field First_Bkg_Dt

How do I create an expression  with this definition

if user has not selected Bkg_Mo then

Sum({\$<First_Bkg_Dt = {">=\$(=MakeDate(Bkg_Yr,1,1)"}>} Revenue)

else

Sum({\$<First_Bkg_Dt = {">=\$(=MakeDate(Bkg_Yr,Bkg_Mo,1)"}>} Revenue)

In English this is what I want to achieve:

If User has selected Bkg_Yr as 2012 and Bkg_Mo as 5 then sum(Revenue) of records with the First_Bkg_Dt > 2012-05-01

If User has selected Bkg_Yr as 2012 and Bkg_Mo not selected then sum(Revenue) of records with the First_Bkg_Dt > 2012-01-01

Thanks

Raghu

• ###### Re: Question Expression  Syntax

Try this:

if(GetSelectedCount(Bkg_Mo), Sum({\$<First_Bkg_Dt = {">=\$(=MakeDate(Bkg_Yr,Bkg_Mo,1)"}>} Revenue), Sum({\$<First_Bkg_Dt = {">=\$(=MakeDate(Bkg_Yr,1,1)"}>} Revenue))

Hope this helps!

• ###### Re: Question Expression  Syntax

Sum({\$<First_Bkg_Dt = {">=\$(=MakeDate(Bkg_Yr,min(Bkg_Mo),1)"}>} Revenue)

• ###### Re: Question Expression  Syntax

Sum({\$<First_Bkg_Dt = {">=\$(=MakeDate(Bkg_Yr, min(Bkg_Mo),1)"}>} Revenue)

This should produce a month of "1" if no month is selected (since all values are between 1 and 12) and a value of the selected month if month is selected.

It's not going to return anything if a year isn't selected, however.

• ###### Re: Question Expression  Syntax

Thank You.