Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all!
I need some help with conditioning a calculation. I want to know how many distinct articles that have a delivery time greater than 2 days. My delivery time is formatted as “D + hh:mm:ss” and works well in other expressions.
Writing my expression as “if(time >=’2 + 00:00:00’, Count(DISTINCT(article),0)” does not work. It only shows the zero-value. What am I doing wrong?
Thank you!
count(if(date#(time,'D + HH:MM:SS')>='2 + 00:00:00',Articles))
Can you paste some sample data please
Articles, time:
a, 2 + 00:00:00
b, 2 + 00:00:00
c, 3 + 00:00:00
b, 2 + 00:00:00
a, 3 + 00:00:00
b, 5 + 00:00:00
a, 1 + 00:00:00
The expression “if(time >=’2 + 00:00:00’, Count(DISTINCT(a),0)” should return "2", since two of the articles "a" have a time >=2, but it returns "0".
if(date#(time,'D + HH:MM:SS')>='2 + 00:00:00',count(DISTINCT(Article)),0)
=COUNT((IF(Timestamp#([time:],'D + hh:mm:ss') >= Timestamp#('2 + 00:00:00','D + hh:mm:ss'),Articles)))
Hi Charlotte, another option:
=If(SubField(time, ' + ', 1)>=2, Count(DISTINCT(article),0))
and another one:
1.In the script create the field Days (or similar) like "SubField(time, ' + ', 1) as Days"
2.Then you can use this field in expression:
=If(Days>=2, Count(DISTINCT(article),0))
or maybe it should be:
=Count(DISTINCT {<Days={">=2"}>} article)
count(if(date#(time,'D + HH:MM:SS')>='2 + 00:00:00',Articles))