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
yellow43
Helper I
Helper I

Lookup value in a column and fill new column in same table

Hello,

 

I am new with DAX and I am having some issues with the following:

 

1. Table has a column 'first_visit' (date type) with some null values;

2. some rows with same 'id' have column 'first_visit' with data and other rows have null values

yellow43_0-1658262448461.png

Output desired:

2022-07-19_21h28_08.png

I have tried LOOKUPVALUE, ISBLANK functions but I am having some syntax problems.

Thank you in advance for your help.

 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @yellow43 

 

You can try the following methods.

New =
IF (
    [first_visit] = BLANK (),
    CALCULATE (
        MIN ( 'Table'[first_visit] ),
        FILTER ( 'Table', [id] = EARLIER ( 'Table'[id] ) )
    ),
    [first_visit]
)

vzhangti_0-1659346761189.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @yellow43 

 

You can try the following methods.

New =
IF (
    [first_visit] = BLANK (),
    CALCULATE (
        MIN ( 'Table'[first_visit] ),
        FILTER ( 'Table', [id] = EARLIER ( 'Table'[id] ) )
    ),
    [first_visit]
)

vzhangti_0-1659346761189.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Thank you @v-zhangti ! It worked just fine.

 

Meanwhile I have tried and came to this solution:

 

newFirstVisit = CALCULATE (
MIN ( Table[FirstVisit] );
ALLEXCEPT ( Table; Table[Id] )
)

Please let me know if this is also an option. Result was what I expected, but this might not be the best solution... is it ok?

vapid128
Solution Specialist
Solution Specialist

Calculate(

    Min(table[fisrt_visit],
    Filter(
        table,
        table[id]=eariler(table[id]) &&

        table[first_visit] <> blank()
    )
)

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.