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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
casperlow
Helper I
Helper I

Dax Sum Unique ID values ones

Hi Dax Guru's
How do I perform a dax measure to calculate the sum of the cost ones for each unique ID.
My current Dax formula: Total Cost = sum(cost) but the output is 1100 which is incorrect.
The correct output should show 600 only 

See image below

casperlow_1-1724830991745.png

 

Appreciate any input on this.
Did my research but could not find any solution that was close enough.

 

 

 

 

 

1 ACCEPTED SOLUTION
Gabry
Super User
Super User

Hello @casperlow , 
if every project has just one value, you can use max with summarize:

 

Total = SUMX(SUMMARIZE('Table','Table'[project id], "val", MAX('Table'[unit])),[val])
Let me know if this helps

 

View solution in original post

4 REPLIES 4
casperlow
Helper I
Helper I

yeah tried this it works on a table but not a on card. preferably works on both. the above solution worked but I had a filter for it to work. 

casperlow
Helper I
Helper I

It doesn't work when I tried this Dax on creating a measure, the error im gettings is "The end of the input was reached."
I had to tweak it a little for it to make it work on my table, I had to add a filter but overall the dax formula works. 🙂 thank you

hello @casperlow 

 

is this what you are looking for?

Irwan_0-1724907924044.png

create a new measure with following DAX.

Total Sum = 
var _Cat = SELECTEDVALUE('Table'[Category])
Return
SUMX(
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Category]=_Cat
    ),
    'Table'[Unit]
)

 

however, if you dont put a selection in slicer, it will become blank.

Irwan_2-1724908026398.png

 

While put them into table will show all the value.

Irwan_1-1724907996014.png

 

Hope this will help.

Thank you.

 

Gabry
Super User
Super User

Hello @casperlow , 
if every project has just one value, you can use max with summarize:

 

Total = SUMX(SUMMARIZE('Table','Table'[project id], "val", MAX('Table'[unit])),[val])
Let me know if this helps

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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