Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Case statement

Status
Not open for further replies.

dbomrrsm

Programmer
Feb 20, 2004
1,709
GB
I have a universe measure with the follwoing code in the select

Code:
CASE
WHEN CMR_DPP.PRODUCT_DIM.DIVISION = 1 AND CMR_DPP.BRAND_DIM.COMPANY = 'LW'
THEN @Select(Weekly Base Measures\ABORTED_DEMAND_VAL) * 4
WHEN CMR_DPP.PRODUCT_DIM.DIVISION != 1 AND CMR_DPP.BRAND_DIM.COMPANY = 'LW'
THEN @Select(Weekly Base Measures\ABORTED_DEMAND_VAL) * 2
ELSE @Select(Weekly Base Measures\ABORTED_DEMAND_VAL)
END

When I parse I get a ORA 00937 error not a single group function.

I think the problem is that @select(Weekly Base Measures\DEMAND_VAL) is an aggregate aware measure.

If I try to build this case statement into the base measure that is aggregate aware I get an error about multiple calls to aggregate awareness.

Can anyone help me with this - maybe I am just doing something really stupid.

TIA

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
You're using @Select. But, the object that you are @selecting has a SUM on it.

If you look at the actual SQL, it doesn't work.

Sum(table.ABORTED_DEMAND_VAL) * 4 is NOT valid SQL for a Select clause.

Get rid of the @Select and use the actual table.column and it will work.

Steve Krandel
Symantec
 
Steve

Thanks for the info - I actually managed to sort this one yesterday.

The problem was as you say - the @Select was a select of a base measure that had aggregate awareness on it and summed values - I had to build the case into the aggregate awareness and it works fine.

Thanks for your time.

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top