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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Sum by date and category

Hi Communtiy 

I have the below dataset (The first 3 variables).  I need to sum the Value by Measure  and by Date every three months starting on September 2020. Any ideas in how I could do that? For example here it is what I need to get 

 

Erika16_1-1686236458872.png

 

Many thanks for your help! 🙂

 

 

 

 

 

 

2 REPLIES 2
slorin
Super User
Super User

Hi

let
Source = YourSource,
Index = Table.AddIndexColumn(YourSource, "Index", 0, 1, Int64.Type),
Groupe = Table.Combine(
Table.Group(
Index,
{"Date"},
{{"Data", each Table.Group(
_,
{"Measure"},
{{"Max_Month",each List.Max([Date])},
{"Sum",each List.Sum([Value])}})}},
GroupKind.Local,
(x,y) => if y[Date]<Date.AddMonths(x[Date],3) then 0 else 1)
[Data]),
Join = Table.NestedJoin(Index, {"Date", "Measure"}, Groupe, {"Max_Month", "Measure"}, "Group", JoinKind.LeftOuter),
Expand = Table.ExpandTableColumn(Join, "Group", {"Sum"}, {"Sum"}),
Sort = Table.Sort(Expand,{{"Index", Order.Ascending}})
in
Sort

 

Stéphane

ronrsnfld
Super User
Super User

In Power Query (Transform option from BI), you can 

  • Add an "end of quarter" column
  • Group by "end of quarter" and "Measure"
  • Aggregate with Sum of Value

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.