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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Jon789
New Member

Cumulative sales

Hi 

 

Relatively new Power BI user.

 

I have some monthly sales data. For example:

Year Month  £

2023 Nov  100

2023 Dec  150

2024 Jan  500

2024  Feb 350

2024  Mar  175

2024  Apr  400

 

I would like to create a line chart with cumulative sales (YTD) sales. So for 2024 - Jan YTD 500, Feb YTD 850, MAr YTD 1025, Apr YTD 1425.

 

Any advice on how I can do this would be appreciated.

 

Thank you

3 REPLIES 3
v-jianpeng-msft
Community Support
Community Support

Your solutions is great @DataNinja777 and @wini_R 
Hi, @Jon789 

Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

wini_R
Resolver III
Resolver III

Hi @Jon789,

Please check this formula for a YTD total:

CALCULATE(
    SUM([Sales column]),

    WINDOW(

        1, ABS,

        0, REL,

        ORDER BY(
            [Year], ASC,

            [Month], ASC

        ),

        PARTITION BY([Year])
    )

)

 

For more details and examples please see this video: https://youtu.be/bxSWQNSQ8rQ?si=nsynUJ7erjFdXAXt&t=2058

DataNinja777
Super User
Super User

Hi @Jon789 ,

You can create YTD calculation using standard dax time intelligence functions, and one of them is TotalYTD as shown below:

DataNinja777_0-1715265060979.png

In order to take advantage of the time intelligence functions, you need to create a separate calendar table and create a relationship between your fact table and the calendar dimension table as show below:

DataNinja777_1-1715265131183.png

I attach an example pbix file.  

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.