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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Poisedon
Frequent Visitor

Sum by category

Hi all,

In the Query I need to sum values by "Client" but I can't use "Group by..." because it deletes other columns. I also want to put 0 for other rows with same Client (can't delete because in other columns i have data). See image for understand.

Immagine.jpg

 

 

 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Poisedon

 

Try a new calculated column like

 

Column =
IF (
    [Value]
        = CALCULATE ( MAX ( Table1[Value] ), ALLEXCEPT ( Table1, Table1[Client] ) ),
    CALCULATE ( SUM ( Table1[Value] ), ALLEXCEPT ( Table1, Table1[Client] ) ),
    0
)

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@Poisedon

 

Try a new calculated column like

 

Column =
IF (
    [Value]
        = CALCULATE ( MAX ( Table1[Value] ), ALLEXCEPT ( Table1, Table1[Client] ) ),
    CALCULATE ( SUM ( Table1[Value] ), ALLEXCEPT ( Table1, Table1[Client] ) ),
    0
)

It works if i take the column with no aggregation, but in my table I've sum of values, so values are wrong in this case 😕

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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