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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jhoyabel19
Helper I
Helper I

How to solve two dates with the same Status Name

Hi Newbie here, 

 

I have this data and i want to pivot the Status to become the column and the status start date as their values however there are status that has two dates. How do I solve this so once i pivot only one date will be captured and should the be earlier dates

 

Vacancy ReferenceCompanyMain RecruiterStatusStatus Start Date
14465Company AJBOffer Accepted (On Boarding Forms In Progress )01/02/2022
14465Company AJBOffer Accepted ( Form Completed )01/02/2022
14465Company AJBOffer Awaiting Applicant Decision01/02/2022
14465Company AJBPreparing Candidate Offer31/01/2022
14465Company AJBOffer Authorising31/01/2022
14465Company AJBOffer Approved31/01/2022
14465Company AJBIncomplete30/10/2021
14465Company AJBPreparing Candidate Offer31/01/2022
14465Company AJBPipeline Candidate17/11/2021
14465Company AJBHired01/02/2022
14465Company AJBHired (no export)17/12/2021
14465Company AJBNew31/10/2021
14465Company AJBNew30/10/2021
14465Company AJBOffer Accepted01/02/2022
14465Company AJBOffer Accepted16/12/2021

 

 

 

7 REPLIES 7
wdx223_Daniel
Super User
Super User

NewStep=Table.Pivot(PreviousStepName,List.Distinct(PrevousStepName[Status]),"Status","Status Start Date",List.Min)

@wdx223_Daniel ,Hi - Thank you but it seems did not work, it captured the older dates 
Pivoted

jhoyabel19_0-1674726002535.png


Original

jhoyabel19_1-1674726050890.png

Anonymous
Not applicable

Hi @jhoyabel19 ,

 

How about replacing List.Min with List.Max?

NewStep=Table.Pivot(PreviousStepName,List.Distinct(PrevousStepName[Status]),"Status","Status Start Date",List.Max)

Pivoted:

vstephenmsft_0-1675147858581.png

Original:

vstephenmsft_2-1675149448761.png

The whole M codes:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tZPBasMwDIZfReTUQiFx1nXntmOsg61hg11KD8ZRM0MrG8Vd17efnJWF3ZzCLrGQ9X/SrySbTfaujSZzhlfcISMZzCbZ0h28prNEz9qSXBk+2oAsibegw7H9DUAODnCvA2bbySZT0+nstifAXOKnhTzWO8HD3Bj0AWsYrQkWTnNtqYEHx4cWVgQVu4axbWEsikLlRZmXRVkOI3c4iGV7jIkrWCdtQxxs7v3eynrEIBrbWkcDWBWj1xwxS021rWVF0PHl7kYYKn2eY/hwLP2pGa71nt0n1gOEKzKX5UVRkasiitT/u62sx70l7BGSVHe5UgkDPFruXKa+nq4eRuQAv7zjML70KhN6veDpx1bSai7ViYv8+zlf/R9EN7PezfYb", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t, #"(blank).4" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}, {"(blank).3", type text}, {"(blank).4", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Vacancy Reference", Int64.Type}, {"Company", type text}, {"Main Recruiter", type text}, {"Status", type text}, {"Status Start Date", type text}}),
    #"Changed Type with Locale" = Table.TransformColumnTypes(#"Changed Type1", {{"Status Start Date", type date}}, "en-GB"),
    Custom1 = Table.Pivot( #"Changed Type with Locale",List.Distinct( #"Changed Type with Locale"[Status]),"Status","Status Start Date",List.Max)
in
    Custom1

 

Best Regards,

Stephen Tao

 

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

 

 

You wrote you wanted the earlier date.  Isn't the the same as the older date?

@ronrsnfld Sorry for the confusion. I want to get the earlier date not the latest date.

the data type of "Status Start Date" is real Date?

@wdx223_Daniel , Yes DD/MM/YYYY
Thank you for the reply

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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