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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
marloswn
New Member

How to get a value filtered by another column in the same table, with DAX

Hello everyone! I'm tryng to select a value based on another column of the same table. In this table, I have a lot of user's IDs, and I have different weights and dates for some users. In this case, I want to return the weight related with the min date, for each user.

 

For example:

 

user_idweightdate
180.501/06/2020
181.310/09/2020
18020/12/2020


Based on this table, I'd like to return just the value '80.5', because for this user, this is the weight with the minimum date.

 

Please, could anyone help me make this happen with DAX?

 

Thanks in advance!

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Hi, @marloswn 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

d1.png

 

You may create a measure as below.

Result = 
var mindate = 
CALCULATE(
    MIN('Table'[Date]),
    ALLEXCEPT('Table','Table'[User_id])
)
return
CALCULATE(
    SUM('Table'[Weight]),
    FILTER(
        ALLEXCEPT('Table','Table'[User_id]),
        [Date]=mindate
    )
)

 

Result:

d2.png

 

Best Regards

Allan

 

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

Thanks @v-alq-msft , but, in this case, I want just de 'weight' column, not user_id. And, as I mentioned, the logic is breaking when it finds an duplicate data. Is there any solution for this?

Hi, @marloswn 

 

You may try the following measure. The pbix file is attached in the end.

Measure = 
CALCULATE(
    SUM('Table'[Weight]),
    FILTER(
        ALL('Table'),
        [Date]=
        CALCULATE(
            MIN('Table'[Date]),
            ALL('Table')
        )
    )
)

 

Result:

a1.png

 

Best Regards

Allan

 

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

marloswn
New Member

Guys, I almost managed to reach a solution:

 

FirstWeight =
VAR SearchValue = MIN(Date)
RETURN
CALCULATE(
SELECTEDVALUE(table[Weight], 999),
FILTER(
ALLNOBLANKROW(table[date]), table[date] == SearchValue),
ALL(table[Weight])
)
 
This is returning 999 when there are two equal dates.
 
Could anyone please help me to fix this issue?
 
Tks!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.