Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2779

Re: Need a help on date selection in Webi and Universe

$
0
0

Hi Ram,

 

You need to do the work at universe level.

At the universe level, you have to create a Native Filter to extract the dates based on your requirement.

 

Here is a sample on SQL Server. I tested it and it works.

 

My_Table.My_Date  BETWEEN

DATEADD(DAY, 1 - DATEPART(WEEKDAY, @Prompt('Start Date','DT','Time\Date',Mono,Constrained,Persistent,,User:-1)), @Prompt('Start Date','DT','Time\Date',Mono,Constrained,Persistent,,User:-1))

AND

DATEADD(DAY, 7 - DATEPART(WEEKDAY, @Prompt('End Date','DT','Time\Date',Mono,Constrained,Persistent,,User:-1)), @Prompt('End Date','DT','Time\Date',Mono,Constrained,Persistent,,User:-1))

 

 

  • My_Table.My_Date is the  Date columns of your table.
  • @Prompt('Start Date','DT','Time\Date',Mono,Constrained,Persistent,,User:-1) is the prompt definition for Start Date
  • @Prompt('End Date','DT','Time\Date',Mono,Constrained,Persistent,,User:-1) is the prompt definition for End Date
  • 'Time\Date' is the class/object in your business layer

You can also create parameters and use them in pllace of the native @Prompt like: @Prompt(Start Date) and @Prompt(End Date). Start Date and End Date are the names of the parameters.

 

The SQL expression is doing the following:

  • Subtract n days from Start Date (1 - day of week) to obtain the first day of the week
  • Add n days to End Date (7 - day of week) to obtain the last day of the week



You need to use the correct SQL expression for the database you are using.


Didier




Viewing all articles
Browse latest Browse all 2779

Trending Articles