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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Yearly difference subtracted from sum of previous years

Hello, 

I want to know how many boxes I totally cleared by year from the start and visualize this.

This is how the raw data looks ( I added a empty column for the readability):

 

Box nr Action date
764-5289 1-1-1907
764-2894 3-2-2017
764-2288 6-7-2017
764-2874 31-8-2017
764-3289 18-8-2018
764-2328 18-10-2018
764-5288 22-2-2019
764-2866 18-4-2019
764-2825 25-5-2019
764-2826 25-5-2019
764-2815 23-7-2019
764-3428 23-8-2019
764-3283 6-9-2019
764-3284 6-9-2019
764-2870 14-2-2020
764-2841 17-4-2020
764-2285 30-1-2021
764-2873 7-2-2021

The information I have:

  • The total number of boxes at the start (Measure) 
    Total boxes with date = DISTINCTCOUNT(action_date[Box nr])
  • The number of boxes per year which needs to be cleared out:
    Number Boxes Year = COUNTX(
        FILTER (action_date, EARLIER(action_date[Action date].[Year])=action_date[Action date].[Year]),action_date[Action date].[Year])
  • The difference between thoose two:  
    Difference = [Total boxes with date]-action_date[Number Boxes Year]

98035538-aee7-4f8a-a2a5-2a9a0f944522.png

But the difference is now a simple subtraction grand total - diffence a year. But what I want to know is not the boxes cleared out at one year but also the years before. Like the table below.

84641150-b64f-43e8-8732-b6c41bdfb683.png

 

How can I achieve this? 

I found this which looks like what I'm looking for. But since I made the calculations with measures ( I only have dates and box number in my data) I can't make a calculated column. 

At the end it has to look something like this (with the right order of years.)

2bb99820-6f99-4e7e-93d1-64a33e542e36.png

 

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.