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
Jarrod
Helper III
Helper III

Cumulative Total Per Group Per Week

Hi All,

 

Struggling to create a measure or calculated column to get the Cumulative Total per Group per week. The report can only display one week at a time. I have a date table containing week number.

 

Dataset example is below (w/o the CumulativeValue)

 

Jarrod_0-1642464219167.png

 

Any help would be appreciated.

 

 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @Jarrod 

 

If your tables are connected via DateID, first add a new column to the Actuals Table:

Week Number = 
RELATED('Date Table'[WeekNumber])

 

then use this code to add a new column for Cumulative Value:

Cumulative Value = 
CALCULATE (
    SUM ( 'Actuals Table'[Value] ),
    FILTER (
        ALLEXCEPT (
            'Actuals Table',
            'Actuals Table'[Metric],
            'Actuals Table'[Week Number]
        ),
        'Actuals Table'[DateID] <= EARLIER ( 'Actuals Table'[DateID] )
    )
)

 

 

Output:

VahidDM_0-1642464971653.png

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

2 REPLIES 2
Jarrod
Helper III
Helper III

Hi @VahidDM,

 

Thank you for your response. This works perfectly! I have also added in the Year to the Filter section as it was adding up last year values.

 

Thanks for your help!

 

VahidDM
Super User
Super User

Hi @Jarrod 

 

If your tables are connected via DateID, first add a new column to the Actuals Table:

Week Number = 
RELATED('Date Table'[WeekNumber])

 

then use this code to add a new column for Cumulative Value:

Cumulative Value = 
CALCULATE (
    SUM ( 'Actuals Table'[Value] ),
    FILTER (
        ALLEXCEPT (
            'Actuals Table',
            'Actuals Table'[Metric],
            'Actuals Table'[Week Number]
        ),
        'Actuals Table'[DateID] <= EARLIER ( 'Actuals Table'[DateID] )
    )
)

 

 

Output:

VahidDM_0-1642464971653.png

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

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.