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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Sharma0815
Helper II
Helper II

Pivot Max date with final status of case

 I am working on dataset where each case contains multiple rows with the status that it went through,i am trying to pivot the max(time_stamp) of my final_decision_time and the final_status of case by the Group.

 

here is my data looks like,

 

CaseWCF_Approv_DecisWCF_Approv_Decis_DateCSA_Approv_DecisCSA_Approv_Decis_DateRSA_Approv_DecisRSA_Approv_Decis_DateFSB_Approv_DecisFSB_Approv_Decis_Date
386646 NULL NULLApproved3/3/2020 15:24 NULL
386646 NULLApproved2/27/2020 16:37 NULL NULL
386646Rejected2/19/2020 17:30 NULL NULL NULL
397142 NULL NULLApproved5/29/2020 18:58 NULL
397142 NULLApproved5/29/2020 18:34 NULL NULL
397142Rejected5/29/2020 13:40 NULL NULL NULL

 

I am trying to get an extra columns with the final_decision_date with status of the case like below.

 

Any way that i can pivot this data by using @dax

 

CaseWCF_Approv_DecisWCF_Approv_Decis_DateCSA_Approv_DecisCSA_Approv_Decis_DateRSA_Approv_DecisRSA_Approv_Decis_DateFSB_Approv_DecisFSB_Approv_Decis_DateFina_DecisionFinal_Decision_Date
386646 NULL NULLApproved3/3/2020 15:24 NULLApproved3/3/2020 15:24
386646 NULLApproved2/27/2020 16:37 NULL NULLApproved3/3/2020 15:24
386646Rejected2/19/2020 17:30 NULL NULL NULLApproved3/3/2020 15:24
397142 NULL NULLApproved5/29/2020 18:58 NULLApproved5/29/2020 18:58
397142 NULLApproved5/29/2020 18:34 NULL NULLApproved5/29/2020 18:58
397142Rejected5/29/2020 13:40 NULL NULL NULLApproved5/29/2020 18:58

 

1 ACCEPTED SOLUTION

@Sharma0815 

 

Please check if your date column's data type is Text? If so, please convert it to date and try again.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@Sharma0815 , try like

new measure =calculate(max(Table[RSA_Approv_Decis_Date]),allexcept(Table[Case]))

 

You can add additional condition

ryan_mayu
Super User
Super User

@Sharma0815 

 

I am not sure if RSA is always the latest status.

 

you can try below measures.

Column2 = MAXX(FILTER('Sheet11','Sheet11'[Case]=EARLIER(Sheet11[Case])),'Sheet11'[RSA_Approv_Decis_Date])

column 1 = MAXX(FILTER('Sheet11','Sheet11'[Case]=EARLIER('Sheet11'[Case])&&'Sheet11'[Column2]='Sheet11'[RSA_Approv_Decis_Date]),'Sheet11'[RSA_Approv_Decis])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu  RSA  is not always be the finla status 

@Sharma0815 

 

Since lastest update of all the sample data  you provided was RSA related, if RSA is not the final status, then formula of the method I provided will be very long.

check FSB, if FSB is null, then check RSA, if RSA is null, check CSA, if CSA is null ,check WCF.

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I will add a conditional statement to get the final status ...,

 

when i try to use your column2 caluclation, i am getting value comparison error 

 

Error

DAX comparison operations do not support comparing values of type Text with values of type Date. Consider using the VALUE or FORMAT function to convert one of the values.

 

Thanks alot

@Sharma0815 

 

Please check if your date column's data type is Text? If so, please convert it to date and try again.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks alot ,appreciated

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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