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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

DAX Calculated Column to show the First Value of another column

Guys, I need your help to create a calculated column (##First Real Lead Time) to return (##Real Lead Time) based on first date and the type of (##WO+LN), like this:

Date##WO+LN##Real Lead Time##First Real Lead Time
9/5/20221234.122211
8/29/20221234.122211
8/22/20221234.122211
8/15/20221234.129211
8/8/20221234.1211211
9/5/20221234.222119
8/29/20221234.222119
8/22/20221234.222119
8/15/20221234.229119
8/8/20221234.2119119

 

Many tks,

Alexandre

1 ACCEPTED SOLUTION
Anonymous
Not applicable

oh no!!!
Anyway, I have find a solution.

I follow this aproach: https://stackoverflow.com/questions/73722277/find-the-first-value-by-category-dax

First, I created a Index column on Power Query.

After that, I created a calculated column with Group Rank:

Group Ranking =
RANKX (
    FILTER (
        Sheet2,
        EARLIER ( Sheet2[##WO+LN] ) = Sheet2[##WO+LN]
    ),
    Sheet2[Index],
    ,
    ASC,
    DENSE
)

truebeatles_0-1663675858949.png

and finally, I added another calculated column:

##First Real Lead Time =
VAR _firstleadtime = CALCULATE(Min(Sheet2[Group Ranking]),ALLEXCEPT(Sheet2,Sheet2[##WO+LN]))
return
    CALCULATE ( FIRSTNONBLANK( Sheet2[##Real Lead Time],1) , ALLEXCEPT(Sheet2,Sheet2[##WO+LN]),Sheet2[Group Ranking] = _firstleadtime)

 

truebeatles_1-1663676852180.png

Now, It's working.

Many tks, Ashish for your time.

---

Alexandre.

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=LOOKUPVALUE([##Real Lead Time],data[Date],CALCULATE(MIN(data[Date]),FILTER(data,data[##WO+LN]=EARLIER([##WO+LN]))),data[##WO+LN],data[##WO+LN])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hello Ashish,

 

I was already looking for lookupvalue and ealier, but I couldn't find the same like you suggested.

Anyway... I use your example, and I got this error message:

truebeatles_0-1663249966675.png

Remember, I'm using this as a calculated column.

I was wondering, may you explain, why you use twice on the end the "data[##WO+LN]"? I want to understand your logic to learn a little more.

 

So, tks for your time.

---

Alexandre

 

Hi,

Share the link from where i can download your PBI file and show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

I am unable to open the file.  When i double click, i just see the splash screen.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

The problem is not with downloading.  When i double click to open the file, the file freezes at the splash screen.  I am able to open other PowerBI Desktop files just fine.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

oh no!!!
Anyway, I have find a solution.

I follow this aproach: https://stackoverflow.com/questions/73722277/find-the-first-value-by-category-dax

First, I created a Index column on Power Query.

After that, I created a calculated column with Group Rank:

Group Ranking =
RANKX (
    FILTER (
        Sheet2,
        EARLIER ( Sheet2[##WO+LN] ) = Sheet2[##WO+LN]
    ),
    Sheet2[Index],
    ,
    ASC,
    DENSE
)

truebeatles_0-1663675858949.png

and finally, I added another calculated column:

##First Real Lead Time =
VAR _firstleadtime = CALCULATE(Min(Sheet2[Group Ranking]),ALLEXCEPT(Sheet2,Sheet2[##WO+LN]))
return
    CALCULATE ( FIRSTNONBLANK( Sheet2[##Real Lead Time],1) , ALLEXCEPT(Sheet2,Sheet2[##WO+LN]),Sheet2[Group Ranking] = _firstleadtime)

 

truebeatles_1-1663676852180.png

Now, It's working.

Many tks, Ashish for your time.

---

Alexandre.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors