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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TomSinAA
Helper III
Helper III

Select distinct to get cost

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

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

 

The measure should show the cost as:

A = $1

B = $20

C=$5

 

1 ACCEPTED SOLUTION
VasTg
Memorable Member
Memorable Member

@TomSinAA 

Did you try max function?

Measure = Max(Table[Delivery Cost])

OR

Choose Maximum in the dropdown.

Cap11.PNG

 

If this helps, mark it as a solution.

Kudos are nice too

Connect on LinkedIn

View solution in original post

4 REPLIES 4
TomSinAA
Helper III
Helper III

Hello,  I have a table wit deliveries and items for each delivery along with a cost for each delivery.  How can I create a measure to get the cost for each distinct delivery. My data looks like this:

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

$5

 

So the measure for the cost for each delivery should be:

A = $1

B = $20

C = $5

 

Hi @TomSinAA ,

 

We can use the following measure in visual to meet your requirement, it will calculate the cost for different divery in visual.

 

Cost Measure = MAX('Table'[Delivery Cost])

 

10.jpg

 


If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 


Best regards,

 

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

One option would be to use a measure like the following

Total Delivery Cost = 
var _costs = SUMMARIZE('Table','Table'[Deliver],'Table'[Delivery Cost])
return sumx(_costs,[Delivery Cost])

 

The other way of doing this would be to split the item level data into one table and the delivery based data into another table as it looks like you have data of mixed grain in this table which is what causes issues like this. This will complicate your data load and require you to build a proper star schema with dimension tables linked to each of the different fact tables, but it will simplify and speed up measures like this.  

VasTg
Memorable Member
Memorable Member

@TomSinAA 

Did you try max function?

Measure = Max(Table[Delivery Cost])

OR

Choose Maximum in the dropdown.

Cap11.PNG

 

If this helps, mark it as a solution.

Kudos are nice too

Connect on LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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