Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Weekly Shift wise Cummulative sum

Hi Guys, I have to calculate shiftwise cummulative of weekly data, In my table 1day of week contains 3 shifts i.e in 1 week there are 21 shifts , when the new week start cummulative should be start...
  • Icey's avatar
    6 years ago

    Hi Anonymous ,

     

    Try this:

     

    1. Add Index column in Power Query Editor.

     

    2. Create a calculated column or measure like so:

    Column = 
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            'Table',
            'Table'[Week] = EARLIER ( 'Table'[Week] )
                && 'Table'[Index] <= EARLIER ( 'Table'[Index] )
        )
    )
    

     

    Measure = 
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALLSELECTED( 'Table' ),
            'Table'[Week] = MAX( 'Table'[Week] )
                && 'Table'[Index] <= MAX( 'Table'[Index] )
        )
    )
    

    BTW, .pbix file attached.

     

     

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.