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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Erika16
Helper II
Helper II

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Kudoed Authors