Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
natisham
Contributor II
Contributor II

Last 7 Days

I have a script that shows hours and an EndDate column. I need to show a graph with dimension weekday (Mon,tues, wed, etc..) with an expression showing the hours of the last week I just uploaded.

weekday.PNG

I am unable to find an dynamic expression that will only show the hours for the days of the last week i uploaded. Need the expression to read the last week (EndDate) i uploaded without me selecting a date. Please help.

1 Solution

Accepted Solutions
Anonymous
Not applicable

Easiest way is in the script, you need to add a column that is the same value for everyday in the week.

Something like

date(floor(WeekEnd(EndDate))) as WeekendDate


then you can do

sum({<WeekendDate={'$(=max(WeekendDate))'}>}Hours)



View solution in original post

12 Replies
alexandros17
Partner - Champion III
Partner - Champion III

When you load data find the max value for EndDate then compute (into a variable 7 days before)

Use the variable in your dimension into the graph.

natisham
Contributor II
Contributor II
Author

I cant figure out a correct variable to use. Any Suggestions?

alexandros17
Partner - Champion III
Partner - Champion III

For instance:

MyTab:

Select Max(EndDate) as maxi, Num(Max(EndDate)-7 as Maxi7 From ....

LET  vMaxi7 = peek('Maxi7,0,'MyTab');

Then use Maxi7 in your Graph

natisham
Contributor II
Contributor II
Author

Is there a way to have a calculated dimension?

=aggr($(maxi7), WeekDay)

natisham
Contributor II
Contributor II
Author

Then my expression would be sum(hours)

Anonymous
Not applicable

Assuming EndDate is a weekend date or something unique for each week.

sum({<EndDate={'$(=max(EndDate))'}>}Hours)

natisham
Contributor II
Contributor II
Author

The expression only shows me sunday data. My dimension is Weekday. Any way to show the data for the whole week. Hours is uploaded daily named EndDate.

natisham
Contributor II
Contributor II
Author

I am trying expression =if(EndDate >= (max(EndDate)-7) and EndDate < max(EndDate), Hours) but there is no data to display

Anonymous
Not applicable

Easiest way is in the script, you need to add a column that is the same value for everyday in the week.

Something like

date(floor(WeekEnd(EndDate))) as WeekendDate


then you can do

sum({<WeekendDate={'$(=max(WeekendDate))'}>}Hours)