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

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

Reply
Pal03
Frequent Visitor

Sum over partition by

Hello everyone , I am trying to achieve this . I have a table with Date , account , segment , revenue and sector. I am trying to get 

total revenue based on Date , Account , segment only.

2018-06-18_14-22-35.png

 

My total revenue changes  everytime there is a new date ,account , segment combination  (ignoring the sector) Please help

 

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @Pal03

 

Here is how you can do it with a calculated column

 

Total Revenue = 
    CALCULATE(
        SUM('Table1'[Revenue]),
        FILTER(
            'Table1',
            'Table1'[Date] = EARLIER('Table1'[Date]) &&
            'Table1'[Account] = EARLIER('Table1'[Account]) &&
            'Table1'[Segment] = EARLIER('Table1'[Segment]) 
            )   
)

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Can we do the same in Power query?

Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @Pal03

 

Here is how you can do it with a calculated column

 

Total Revenue = 
    CALCULATE(
        SUM('Table1'[Revenue]),
        FILTER(
            'Table1',
            'Table1'[Date] = EARLIER('Table1'[Date]) &&
            'Table1'[Account] = EARLIER('Table1'[Account]) &&
            'Table1'[Segment] = EARLIER('Table1'[Segment]) 
            )   
)

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

A couple of years let, but thanks for this reply!! it saved my @$$

 

Anonymous
Not applicable

Thanks a lot!!

Just wondering - Would it be possible to do this using power query / M?

Thanks a ton . It works !!

Pal03
Frequent Visitor

Actually quite excited that it works in power BI. Once again thank you 🙂

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Solution Authors