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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ApplySimple

Status
Not open for further replies.

petperson

Programmer
Oct 2, 2002
106
US
Is it possible for me to use the applysimple function to create an attribute that displays 'next week'? I am trying to use something like this: select week_dt+7 from weeks as NWK_WEEK_DT but I know I am missing something. DBA wants to get out of creating a MV for this. Any suggestions? thanks!
 
Dear petperson,

If your are using Oracle as warehouse you can use Applysimple as follows:

ApplySimple("#0+7",columnname)

Here #0 is a placeholder where the columnname will come when the expression is evaluated. So 7 days will be added to the columnname (which is a date column).

If any other database is there then use the syntax that is legal in that database. But the placeholder(#0) should be there within the double quotes with plus 7, then comma and then the column name.

Try do this. It will definitely work.

Thanks.

User14
 
you probably don't need applysimple, just use "week_dt+7" as your id expression.
 
Thanks for your responses. I was able to create an attribute using the applysimple function with Week_Dt. What I am really trying to do, is to use this Next Week attribute object in place of a transformation table so that I can apply this to a metric in order to return budget $ for next week. I am trying to create my dynamic date filter to use in the conditional metric. Do I still need to use today +7 in the attribute qualification? I would think it would use the definition on the Next Week attribute I created in order to add the 7 days. I'm confused..does it show??
 
I think nlim's approach is the way to go...using applysimple complicates things...why reinvent the wheel when you have the functionality there already?

If you are working with budget concerns, you probably have base metrics (actual expenses, budgeted expenses) -- and their variants (variable, fixed).

Your template probably looks something like this:

ACTUAL | BUDGET
------------------------
DATE |

What you are really trying to do is change the 'Where' clause of the SQL to get a specific date range, i.e. Where date_id = getdate() + 7 -- which would imply expenses for next week. What it comes down to is the filter, so the filter has to force date_id + 7, which isn't a big deal if you let a dynamic date filter do the work for you. BTW, getdate() could be a fixed, prompted date that could reflect the end of a specific week.

Probably a more verbose answer than needed, but I think a little tinkering with dynamic dates would do you a lot of good.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top