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
Anonymous
Not applicable

Create a measure that calculates sum of distinct values over multiple columns in a table

My table has following structure:

Knipsel.PNG

 

In this table, if a combination of country and case have multiple weapons involved, the value shall be contained in those multiple rows(for example the 200 in row 2 and 3 here). However, I want to be able to create a table visual that gives the sum of the value per country, taking into account that only the distinct values per country and case should be summed up.

Table should look like this:

Germany 300

Belgium 200

Netherlands 100.

I'd like to use a calculated measure for this, but not sure how to code it. Can someone help me?
Regards,
Sander

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

Try this

 

Totals =
SUMX (
    SUMMARIZE (
        Country,
        Country[Country],
        Country[Case],
        "Value", DISTINCT ( Country[Value] )
    ),
    [Value]
)

Replace Country by your tablename.

 

Cheers

 

CheenuSing

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous 

 

Try this

 

Totals =
SUMX (
    SUMMARIZE (
        Country,
        Country[Country],
        Country[Case],
        "Value", DISTINCT ( Country[Value] )
    ),
    [Value]
)

Replace Country by your tablename.

 

Cheers

 

CheenuSing

Anonymous
Not applicable

Hi @Anonymous ,

 

I forgot to add the following lines.

 

Now create a table visual with Country and Totals

 

You will get your desired result.

 

Cheers

 

CheenuSing

vanessafvg
Super User
Super User

@Anonymous  hi can you explain the rule a bit better, why for germany is it only 300 and not 400?  there doesnt seem to be a clear rule for which row you want if there is more than one.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.