Quantcast
Channel: SCN : Unanswered Discussions - Semantic Layer
Viewing all articles
Browse latest Browse all 1291

Difficulties having the between clause in the period where clause

$
0
0

Hi,

I am trying to create two dimensions for the sales date. One is "Month Name" and the other one is "Year" . So in the business layer, I crated two dimensions based on the sales date. "Month Name" ==> to_char(sales_date,'Month') and Year ==> to_number(to_char(sales_date,'YYYY')) . The database is oracle database. When I am  providing the "Month Name " and "Year" as two dimensions to the user ( which most user ask for), then they are going to use it in the filter. For an example. Show me the total sales and profit between "July 2013"  and "June 2014"

 

So in that case they will put the year in the filter  panel and select "Year" Between 2013 and 2014

and then they will put the Month name in the filter panel and select "Month Name" between "July" and "June"

 

So they expect the resulting query should form something like shown below and return the results

 

SELECT BRANCH, SUM(SALES), SUM(PROFIT)

FROM BRANCH, SALES, .....

WHERE SALES_DATE BETWEEN TO_DATE("July, 2013", "Month, YYYY")  and TO_DATE("June, 2014",'Month, YYYY")

AND ...................

 

But it is not the query that is generated , The query that is generated is something like this

 

SELECT BRANCH, SUM(SALES), SUM(PROFIT)

FROM BRANCH, SALES, .....

WHERE to_char(sales_date,'Month') between 'July' and 'June'

AND to_numebr(to_char(sales_date,'yyyy')) between 2013 and 2014

AND ...................

 

Is there a way to create a dimensions differently in Information Design Tool ? So the user can see the "Month Name" and "Year" as two separate dimensions but the query should work as expected in the example above ?

 

Thanks


Viewing all articles
Browse latest Browse all 1291

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>