Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
we face the following problem:
Count({<closed_year={"$(=Date(Date#(Year(today()),'YYYY'),'YYYY'))"}>} DISTINCT ID) is working fine, but we need to add an if-statement within the set analysis.
If Month=January it should be (Date#(Year(today()),'YYYY')-1 ==> the year before; but how does the syntax work?
Thank you in advance!
Hi,
if(Month='January',Count({<closed_year={"$(=Date(Date#(Year(today()),'YYYY')-1,'YYYY'))"}>} DISTINCT ID),Count({<closed_year={"$(=Date(Date#(Year(today()),'YYYY'),'YYYY'))"}>} DISTINCT ID) )
Hi Corinna,
I would recommend creating a variable which does the if statement and results in the correct end value. You can then use that variable in your set analysis
something like
create vDate variable
=If(Month(today())='Jan',Date#(Year(today()),'YYYY')-1, Date#(Year(today()),'YYYY'))
Count({<closed_year={"$(vDate"}>} DISTINCT ID)
just keeps your expression cleaner and means you can reuse the same variable for other expressions
Hope that helps
Joe
Hi,
if(Month='January',Count({<closed_year={"$(=Date(Date#(Year(today()),'YYYY')-1,'YYYY'))"}>} DISTINCT ID),Count({<closed_year={"$(=Date(Date#(Year(today()),'YYYY'),'YYYY'))"}>} DISTINCT ID) )