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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
sergioivanov
New Member

How to add previous month sales to current month sales

Hello all,

I'm trying to compare the YTD sales with the goals on YTD format. This is the idea that I want to present:

sergioivanov_0-1640201775221.png

I can make a table adding the goal of each month, which then I can graph as the blue line. The table below:

sergioivanov_1-1640202143531.png

The problem I'm finding is how to add what was sold in Oct (in the image) with Nov, so those sales stack up in Nov, the same with Dec (which should be Oct, Nov and Dec stacked), and so on.

The idea of the graph is to show how deviated the sales are resulting against the final goal amount.

I tried with TOTALYTD, but it won't add up the months' results.

Is there any other function? Or other visualization to achieve this?

Thank you. 

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @sergioivanov 

 

You may try this Measure.

YTD venta = CALCULATE(SUM('Table'[Venta]),FILTER(ALL('Table'),'Table'[Px]<=MAX('Table'[Px])))

 

The result should look like this:

vcazhengmsft_0-1640591540702.png

 

For more details, please refer to the attached pbix file.

 

Best Regards,

Community Support Team _ Caiyun

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

View solution in original post

3 REPLIES 3
v-cazheng-msft
Community Support
Community Support

Hi @sergioivanov 

 

You may try this Measure.

YTD venta = CALCULATE(SUM('Table'[Venta]),FILTER(ALL('Table'),'Table'[Px]<=MAX('Table'[Px])))

 

The result should look like this:

vcazhengmsft_0-1640591540702.png

 

For more details, please refer to the attached pbix file.

 

Best Regards,

Community Support Team _ Caiyun

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

ValtteriN
Super User
Super User

Hi,

For YTD calculation you can use this pattern: CALCULATE(SUM('Table'[Value]),DATESYTD('Calendar'[Date])).

I also recommend checking out SQLBI's article on running totals: https://www.sqlbi.com/articles/computing-running-totals-in-dax/

I hope these will help you to solve your issue and if they do consider accepting this post as a solution and giving it a thumbs up!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi ValtteriN,

Thank you for your reply, but that pattern brings the same results as a TOTALYTD.

What is needed is a calculation that can add the previous months sales to the current month:

sergioivanov_0-1640270868991.png

October should be 39; November should be 181; December 220, as it shows in the third column.

Thank you!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

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