Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
pgrs4219
Contributor III
Contributor III

Last 5 business day trend?

Hi All,

I've a requirement that i need to show last 5 business days data depends on date selected.

i've tried something like this below. 

Concat(Distinct{<DateField={">$(=Date(floor(Max(DateField)-5),'DD MMM YY'))<=$(=Date(floor(max(Datefield)),'DD MMM YY'))"} >} Datefield,',')

but there is problem here if there is weekend  in between the last 5 days its ignoring the weekends and showing only 3 avialble days as am using Datefield-5

For instance if i select 18 May 2020 out will be the following 

18 May 20, 15 May 20, 14 May 20. 

desired output should be like 18 May 20, 15 May 20, 14 May 20 13 May 20, 12 May 20.

basically i need to show the last 5 business days .

Kindly Help me with this 

 

Thanks inadvertence 

 

 

Labels (1)
3 Replies
vamsee
Specialist
Specialist

Try creating a flag in the script for workdays only and use the flag in your expression

Example: if(weekday(DATEFIELD) <5, 'Weekday, 'Weekend') as Flag

in the expression Flag={'Weekday'}

Also refer Networkdays

to create a list of holidays of your organization and omit them from the expression

pgrs4219
Contributor III
Contributor III
Author

Thanks for the quick reply vamsi, 

I'll try the following method but i have to show weekends also if there is a data. 

Basically what ever the dates my date field has i've to show the last 5 days trend as per the selection

vamsee
Specialist
Specialist

Try changing the expression to 

if(Len(DATA_FIELD)>0, 'Data, 'No Data') as Flag

This would show only the dates where the DATA_FIELD is populated, as there is no check on dates would populate weekends with data too.