Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

4 Replies
jerem1234
Specialist II
Specialist II

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!

Clever_Anjos
Employee
Employee

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

greg-anderson
Luminary Alumni
Luminary Alumni

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.

Not applicable
Author

Thank You.