cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TomSinAA Helper I
Helper I

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

Accepted Solutions
Community Support
Community Support

Re: Select distinct to get cost

@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
Super User I
Super User I

Re: Select distinct to get cost

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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Community Support
Community Support

Re: Select distinct to get cost

@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

TomSinAA Helper I
Helper I

Re: Select distinct to get cost

Yes, it should be $20

 

Super User I
Super User I

Re: Select distinct to get cost

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. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Super User IV
Super User IV

Re: Select distinct to get cost

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/
TomSinAA Helper I
Helper I

Re: Select distinct to get cost

Yes, my mistake. It should be 20

Super User IV
Super User IV

Re: Select distinct to get cost

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/

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors