on 11-11-2015 7:39 PM
Hello there I am brand new to the forum and might be here for a while as I have just been placed on a BO project for work and have only done some training. I want to thank you in advance for any help received.
I am trying to count the number of rows returned by a field but only when a particular date field is less than current date. I have created a measure object for this. The where statement did not work out for me when I combined with other objects, so I guess I need to use a case statement in my select statement. Following an example I have come up with the following:
COUNT(CASE SALES.SALES_DATE WHEN < sysdate THEN SALES.PRODUCT_NO ELSE 0 END)
However the error I have received is Invalid Expression: missing Expression. What am I missing?
On the Webi side, if then else replaces case expressions and CurrentDate() replaces sysdate:
=Count([Product No]) Where ([Sales Date]<CurrentDate())
If you're creating a Universe level object, use:
COUNT(CASE WHEN SALES.SALES_DATE < SYSDATE THEN SALES.PRODUCT_NO END)
If you have ELSE 0 at the end, you'd count the 0 and end up with a wrong answer.
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sorry but you're trying to Count at report or query side?
Regards,
Rogerio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.