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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
DBrito79
Frequent Visitor

Find first values per earliest Date

Hello,
I have a table called "Cycles" and i need a dax column with the value (the name) of CYCLES[Status Atual] for the earlier/maximum [FirstMatingDate] and for each CYCLES[ID&FARM]


I am trying this formula:

EarliestStatusAtFirstMatingDate =
CALCULATEMAXX(
FILTERALL(CYCLES),
CYCLES[FirstMatingDate] = CALCULATEMAX(CYCLES[FirstMatingDate]),
ALLEXCEPT(CYCLES, CYCLES[ID&FARM])
)),
CYCLES[Status Atual]
)))

 

But it returns the me the status name with the last alfabethical order.

Can you help me with this?
Thanks in advance

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @DBrito79,

You can try to use the following measure formula if it suitable for your requirement:

EarliestStatusAtFirstMatingDate =
VAR _lastDate =
    CALCULATE (
        MAX ( CYCLES[FirstMatingDate] ),
        ALLSELECTED ( CYCLES ),
        VALUES ( CYCLES[ID&FARM] )
    )
RETURN
    CALCULATE (
        MAX ( CYCLES[Status Atual] ),
        FILTER ( ALLSELECTED ( CYCLES ), CYCLES[FirstMatingDate] = _lastDate )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

HI @DBrito79,

You can try to use the following measure formula if it suitable for your requirement:

EarliestStatusAtFirstMatingDate =
VAR _lastDate =
    CALCULATE (
        MAX ( CYCLES[FirstMatingDate] ),
        ALLSELECTED ( CYCLES ),
        VALUES ( CYCLES[ID&FARM] )
    )
RETURN
    CALCULATE (
        MAX ( CYCLES[Status Atual] ),
        FILTER ( ALLSELECTED ( CYCLES ), CYCLES[FirstMatingDate] = _lastDate )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

It worked... Thanks a million, Sorry for the delay ansewring . Regards

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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