cancel
Showing results 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

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:

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

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
Community Support

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:

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!

3 REPLIES 3
Community Support

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:

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!

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!

Proud to be a Super User!

New Member

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:

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

Thank you!

Announcements

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.

Power BI Monthly Update - August 2024

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

Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors