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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Tiitti7
Frequent Visitor

Problems with creating the measure

I need to create a measure that returns the smallest "CostID" value for each distinct ID and ignores all other values.

 

CostID represents the order start date in this case, and there is no separate start date in the data model. In the chart, the X-axis should display the year and month, while the Y-axis should show the order date based on this measure.

 

In this case, there are 2 orders with start dates of 2020-01 and 2020-03.

 

Is that possible? 



Tiitti7_0-1738235512220.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Tiitti7 

Based on your information, I create a sample table:

vyohuamsft_0-1738546008708.png

Then create new measure and try the following DAX:

SmallestCostID = 
CALCULATE(
    MIN('Table'[CostID]),
    ALLEXCEPT('Table', 'Table'[ID])
)

 

Create visual and put this measure in it, here is my preview:

vyohuamsft_1-1738546114667.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

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

2 REPLIES 2
Anonymous
Not applicable

Hi, @Tiitti7 

Based on your information, I create a sample table:

vyohuamsft_0-1738546008708.png

Then create new measure and try the following DAX:

SmallestCostID = 
CALCULATE(
    MIN('Table'[CostID]),
    ALLEXCEPT('Table', 'Table'[ID])
)

 

Create visual and put this measure in it, here is my preview:

vyohuamsft_1-1738546114667.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bhanu_gautam
Super User
Super User

@Tiitti7 , Try using ALLEXCEPT

 

MinCostID =
CALCULATE(
MIN(Table[CostID]),
ALLEXCEPT(Table, Table[ID])
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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