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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
2023Lee
Frequent Visitor

Sum of column A' values based on distinct values in column B

Dear

I got a problem when calculate the distinct sum value.

I want to get the sum value of different "category" based on the distinct value in column "Time", which means I want the value"sum technical =60+15","sum External = 20+10".

I have try this DAX

"

Technical-Distinct =

calculate(

    sum('Test'[Value]),

    'Test'[Category]="Technical",

    distinct('Test'[Time])

    )

"

But it seems didn't work.😭

Anybody could help that?

Very appreciate it!

IDCategoryValueTime
1Technical608/25/2023 11:00
2Technical608/25/2023 11:00
3Technical608/25/2023 11:00
1External208/25/2023 11:00
2External208/25/2023 11:00
3External208/25/2023 11:00
4Technical159/15/2023 17:00
5Technical159/15/2023 17:00
4External109/15/2023 17:00
5External109/15/2023 17:00
3 ACCEPTED SOLUTIONS
FreemanZ
Super User
Super User

Hi @2023Lee ,

 

try like:

Technical-Distinct = 
SUMX(
    FILTER(
        SUMMARIZE(
            test,
            test[category],
            test[time],
            test[value]
        ),
        test[category]="Technical"
    ),
    test[value]
)

 

it worked like:

FreemanZ_0-1701873089807.png

View solution in original post

Fowmy
Super User
Super User

@2023Lee 

Add a table visual on your canves, add the category and the following measure:

M1 = 
SUMX(
    SUMMARIZE( Table10 , Table10[Category] , Table10[Time] ) , 
    CALCULATE( MAX( Table10[Value] ) )
)

 

Fowmy_0-1701873565573.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

So nice of you!

Very thanks you give the solution of this case, that is what I want. 

I also can apply this to many similar cases.🤗

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@2023Lee 

Add a table visual on your canves, add the category and the following measure:

M1 = 
SUMX(
    SUMMARIZE( Table10 , Table10[Category] , Table10[Time] ) , 
    CALCULATE( MAX( Table10[Value] ) )
)

 

Fowmy_0-1701873565573.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

2023Lee
Frequent Visitor

Hi @Fowmy 

I tried your solutions, it looks very well when I use use a table or chart visual, just need to add the category as column/legend.

Tnanks for your sharing, which also gives me some ideas to get more data.😀

FreemanZ
Super User
Super User

Hi @2023Lee ,

 

try like:

Technical-Distinct = 
SUMX(
    FILTER(
        SUMMARIZE(
            test,
            test[category],
            test[time],
            test[value]
        ),
        test[category]="Technical"
    ),
    test[value]
)

 

it worked like:

FreemanZ_0-1701873089807.png

So nice of you!

Very thanks you give the solution of this case, that is what I want. 

I also can apply this to many similar cases.🤗

BeaBF
Super User
Super User

@2023Lee Hi! Try with:
DistinctSum =
SUMX (
VALUES ( 'Test'[Time] ),
CALCULATE (
SUM ( 'Test'[Value] ),
ALLEXCEPT ( 'Test', 'Test'[Category] )
)
)

BBF

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.