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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Steven_Wu
Frequent Visitor

How could I transform the table based on date and specific column at the same time with DAX?

Hi, All,

I have a dataframe as follow. There are 2 players' training records.

For calculating and present the current completion status, I have to filter the current table based on the Status and Latest Date.

 

Status: Only keep the single completed activity and incomplete activity. If the activity is completed and have duplicate name. Just remove it.

Completion Date: Just keep the latest completion date.

 

Is there any way I could conver the Table A to Table B? Thank you.

Table A

PlayerTraining IDActivity NameCompletion DateStatus
A23FFootball3/2/2023Completed
A22FFootball9/1/2022Completed
A23BBaseball--Incompleted
A22BBaseball--Incompleted
A23TTennis--Incompleted
A22TTennis--Incompleted
B23FFootball4/2/2023Completed
B22FFootball--Incompleted
B23BBaseball--Incompleted
B22BBaseball--Incompleted

 

Table B

PlayerActivity NameCompletion DateStatus
AFootball3/2/2023Completed
ABaseball--Incompleted
ATennis--Incompleted
BFootball4/2/2023Completed
BBaseball--Incompleted

 

1 ACCEPTED SOLUTION
barritown
Super User
Super User

Hi @Steven_Wu,

You could try creating a new table in Table Tools via this code:

barritown_0-1689251157934.png

In plain text:

Table = SUMMARIZE ( 
    data, 
    [Player], 
    [Activity Name], 
    "Completion Date", 
    MAX ( data[Completion Date] ),
    "Status", 
    IF ( "Completed" IN VALUES ( data[Status] ), "Completed", "Incompleted" )
 )

 

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

View solution in original post

2 REPLIES 2
Steven_Wu
Frequent Visitor

Thank you, Alexander,

it's what I need. Thank you so much~

barritown
Super User
Super User

Hi @Steven_Wu,

You could try creating a new table in Table Tools via this code:

barritown_0-1689251157934.png

In plain text:

Table = SUMMARIZE ( 
    data, 
    [Player], 
    [Activity Name], 
    "Completion Date", 
    MAX ( data[Completion Date] ),
    "Status", 
    IF ( "Completed" IN VALUES ( data[Status] ), "Completed", "Incompleted" )
 )

 

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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