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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Aymeric_bls
New Member

Running total with filters

Hello,

 

I'm currently trying to set-up a board where I could have an overview about the workloading of people per day.

I have a data table with the following inputs (the last column is a calculated column) :

TASK   PILOTE   STARTING_DATE   ENDING_DATE   WORKLOAD (in hour)   WORKLOAD_PER_DAY (Workload / (end-start))
1a19/04/202121/04/202166h / 3 = 2h per day
2a20/04/2021

22/04/2021

99h / 3 = 3h per day
3b19/04/202122/04/202188h / 4 = 2h per day
4c19/04/202120/04/202188h / 2 = 4h per day

 

I set up a calendar data base where I want to create a measure that will cumulate the daily workload of each tasks in order to have a visual chart and make sure the cumulated workload of each day is not more than x hours.

In this measure, I'd like to include a filter in order to vizualize this chart for each pilote.

In my mind, it looks like :

 

For each day of the Calendar table,

if STARTING_DATE <= Calendar[DATE] and ENDING_DATE > Calendar[DATE] and PILOTE = the one selected in the filters

then sum all the WORKLOAD_PER_DAY

 

It should return something like the following result :

 

Calendar data table for PILOTE = a :

DATEMeasure of Daily workload
19/04/2021  |  2 hours (task 1 only)
20/04/2021  |  5 hours (task 1 + task 2)
21/04/2021  |  5 hours (task 1 + task 2)
22/04/2021  |  3 hours (task 2 only)
23/04/2021  |  0 hours

 

Is there anybody who could guide me in this challenge ?

 

Thanks a lot for your help !

1 ACCEPTED SOLUTION
Anonymous
Not applicable

[Daily Workload] =
// This measure only works on the individual
// date level. If anything more than one day
// is visible in the current context - blank
// will be returned.
var vDateSelected = SELECTEDVALUE( Calendar[Date] )
var vSumOfWorkloadPerDay =
    CALCULATE(
        SUM( T[Workload_Per_Day] ),
        // Note that you should not slice
        // by any columns in your fact table.
        // Please use dimensions instead.
        // The only exception to this rule is
        // a degenerate dimension (but you
        // don't seem to have it). Also, this code
        // assumes that Starting_Date and
        // Ending_Date can't be BLANK.
        KEEPFILTERS( T[Starting_Date] <= vDateSelected ),
        KEEPFILTERS( vDateSelected < T[Ending_Date] )
    )
RETURN
    vSumOfWorkloadPerDay

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

[Daily Workload] =
// This measure only works on the individual
// date level. If anything more than one day
// is visible in the current context - blank
// will be returned.
var vDateSelected = SELECTEDVALUE( Calendar[Date] )
var vSumOfWorkloadPerDay =
    CALCULATE(
        SUM( T[Workload_Per_Day] ),
        // Note that you should not slice
        // by any columns in your fact table.
        // Please use dimensions instead.
        // The only exception to this rule is
        // a degenerate dimension (but you
        // don't seem to have it). Also, this code
        // assumes that Starting_Date and
        // Ending_Date can't be BLANK.
        KEEPFILTERS( T[Starting_Date] <= vDateSelected ),
        KEEPFILTERS( vDateSelected < T[Ending_Date] )
    )
RETURN
    vSumOfWorkloadPerDay

Hello Daxer,

Your solution works perfectly, thanks a lot ! 😊

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.