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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
TomSinAA
Helper IV
Helper IV

Select distinct to get cost

I am trying to create a measure to get the cost for each delivery. My data looks like:

DeliverItemDelivery Cost
A1$1
A2$1
A3$1
A4$1
A5$1
B6$20
B7$20
B8$5
C9$5

 

So the measure should show the cost as:

A=$1

B=$20

C=$5

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@TomSinAA 

 

You may try the measure below.

Measure =
SUMX (
    VALUES ( 'Table'[Deliver] ),
    CALCULATE ( MAX ( 'Table'[Delivery Cost] ) )
)

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

For B, there are 2 unique costs - 20 and 5.  Why should the answer be 20?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Yes, my mistake. It should be 20

Hi,

Drag Deliver to the Table visual and write these measures

Measure = MIN(Data[Delivery Cost])

Min delivery cost = SUMX(SUMMARIZE(VALUES(Data[Delivery]),VALUES(Data[Delivery],"ABCD",[Measure]),[ABCD])

Drag the second measure to the visual.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-chuncz-msft
Community Support
Community Support

@TomSinAA 

 

You may try the measure below.

Measure =
SUMX (
    VALUES ( 'Table'[Deliver] ),
    CALCULATE ( MAX ( 'Table'[Delivery Cost] ) )
)

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MartynRamsden
Solution Sage
Solution Sage

Hi @TomSinAA 

 

Could you confirm if the Delivery Cost for row 8 of your data should be $20?

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

Yes, it should be $20

 

Hi @v-chuncz-msft 

 

Try this:

Cost = 
SUMX (
    SUMMARIZE (
        Table1,
        Table1[Deliver],
        Table1[Delivery Cost]
    ),
    Table1[Delivery Cost]
)

 

Best regardsm,

Martyn

 

If I answered your question, please help others by accepting it as a solution. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.