Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
danieldors
Contributor III
Contributor III

Running Avg for a Week

Hello,

 

Im trying to calculate the running total average for a week, week starts Sunday ends Saturday. On Wednesday for example I would like to show the totals for Sun, Mon,Tues, but divide that total by 2, not 3 excluding the weekend dates.

 

IF([DD_StateProduction$.Date]=max( TOTAL [DD_StateProduction$.Date]), sum([Total Drivers])/num(Weekday(today())), sum([Total Drivers])/5)

Thank you

Labels (1)
1 Reply
vinieme12
Champion III
Champion III

Just add another flag field to mark weekdays and 1 and weekends as 0 , let's call it flag_Weekday: if Date =weekday then 1 else 0

Then assuming you have a calender in your data model 

Sum({<Week={"=Max(Week)"}>}total divers)

/

Sum({<Week={"=Max(Week)"}>}flag_Weekdays)

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.