cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Frequent Visitor

## Create table with group and cummulative sum

Hi all. Could use some help 🙏
Not sure if this is done easier in Power Query or DAX, either works for me.

I need to create a custom table based off of transactions for stock changes. The tricky part is that the correct sum at the end of the month i the total sum of ALL transactions up till that date. I then need to group these per Item and month. Example below:

Here is an extract of the current table and I need to create a new table grouped by Item and whole month with the sum of all previous cost amounts up till that month.

The end result would be something like this. Item_No summerized, whole month and sum of cost up till that end of month (note not only sum within that month but sum of all previous transaction for that item)

Any help much appreciated

1 ACCEPTED SOLUTION
Super User

@Hannisky , Create a date table, join with date of you table, add month end date date if needed as column

and try a measure like

Cumm Sales = CALCULATE(SUM(Table[Cost Amount Actual]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

Cumm Sales = CALCULATE(SUM(Table[Cost Amount Actual]),filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

Super User

@Hannisky , Create a date table, join with date of you table, add month end date date if needed as column

and try a measure like

Cumm Sales = CALCULATE(SUM(Table[Cost Amount Actual]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

Cumm Sales = CALCULATE(SUM(Table[Cost Amount Actual]),filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors
Users online (4,840)