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
cborde3
Frequent Visitor

Running Totals for Two Years

Hello,
I'm trying to display the running total of errors for two years in a line graph so that they can be compared. I need  a visual similar to this:
 
cborde3_0-1679095769391.png
 
My calculation for 2023 is:
 
2023 = TOTALYTD(SUM('PA Switching Errors'[Distinct]),'Calendar'[Date])
 
2023's calculation tracks correctly.
 
For 2022, I'm trying:
 
2022 Cumulative Errors = CALCULATE(
        SUM('PA Switching Errors'[Distinct]),
            FILTER('PA Switching Errors',
                    'PA Switching Errors'[Year] = "2022"))
 
2022 does not track correctly.  These two result in the following graph:
 
cborde3_0-1679097363997.png

 

I can't get 2022 to give me a cumulative line.
 
Also, when placed in a table, the 2022 cumulative calculation gives this, which is clearly not cumulative:
 
cborde3_0-1679097549731.png

 

 
Thanks in advance for any assistance.
 

 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Anonymous
Not applicable

Hi @cborde3 ,

You can update the formula of measure as below to get the culmulative values, please find the details in the attachment.. If you want to get the value for the specific year, you can add the condition: YEAR(_seldate)=2022 to get it.

Sample 2022 Cumulative Errors = 
VAR _seldate =
    SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        SUM ( Sheet1[Distinct] ),
        FILTER ( ALLSELECTED ( Sheet1 ), 'Sheet1'[Date] <= _seldate )
    )

yingyinr_0-1679361627029.png

Best Regards

View solution in original post

6 REPLIES 6
cborde3
Frequent Visitor

Thank you all for your support!

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi  @cborde3 ,

Please update the formula of measure [2022 Cumulative Errors] as below and check if it can return the expected result...

2022 Cumulative Errors =
VAR _seldate =
    SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        SUM ( 'PA Switching Errors'[Distinct] ),
        FILTER (
            ALLSELECTED ( 'PA Switching Errors' ),
            'PA Switching Errors'[Year] = "2022"
                && 'PA Switching Errors'[Incident Date] <= _seldate
        )
    )

 

If the above one can't help you, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Hello,

 

I've copied a sample file to drop box.  The link is below.

 

https://www.dropbox.com/s/h5p40g7upwqoi4b/Sample%20Sheet%20%281%29.pbix?dl=0

Anonymous
Not applicable

Hi @cborde3 ,

You can update the formula of measure as below to get the culmulative values, please find the details in the attachment.. If you want to get the value for the specific year, you can add the condition: YEAR(_seldate)=2022 to get it.

Sample 2022 Cumulative Errors = 
VAR _seldate =
    SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        SUM ( Sheet1[Distinct] ),
        FILTER ( ALLSELECTED ( Sheet1 ), 'Sheet1'[Date] <= _seldate )
    )

yingyinr_0-1679361627029.png

Best Regards

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 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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