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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mvgust
Helper III
Helper III

Create Running Total Column based on employee and continous dates

I think the best solution to my problem is to create a running total column for a table.  I need to sum hours by employee for continous dates.  I'll then be using the numbers in that column do do further filtering.

 

Below is an example of my data:

running total.png

Each time there is a gap in the date sequence for an employee, I need the running total to start over on summing the hours.

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

@mvgust , apparently, [Timecard ID] column already bins the table by consecutive days, thus you can authored a formula for calculated column like this,

Running Total =
SUMX (
    CALCULATETABLE (
        Data,
        ALLEXCEPT ( Data, Data[Timecard ID], Data[Employee ID] ),
        Data[date] <= EARLIER ( Data[date] )
    ),
    Data[Hours]
)

Screenshot 2020-10-01 195407.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

While my table has timecard ID I can't use this as part of my context as we're looking at consecutive days regardless of what timecard the days fall into.  

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors