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
Anonymous
Not applicable

Selecting Last Activity

Hello All,

Pleaseeee!!! I need help from the gurus in Power BI community.

I have a 2 Fact tables I need to be able to select the last activity for the corresponding date from the table below.

I have tried to use Max date but it's not accurate. Attched is a screen shot of the table and the last activity I would like to get i 8-Final Mech but it's not the last date or max datestg.png

I have tried to use these formulas

CURRENT =
VAR LASTSTAGE = CALCULATE(
MAX('CONSTRUCTION SCHEDULE'[Index]),
ALLEXCEPT('CONSTRUCTION SCHEDULE','CONSTRUCTION SCHEDULE'[HOUSE NUMBER])
)
RETURN CALCULATE(
SELECTEDVALUE('CONSTRUCTION SCHEDULE'[STAGES]),
ALL('CONSTRUCTION SCHEDULE'),
'CONSTRUCTION SCHEDULE'[Index]=LASTSTAGE
)
 
and 
LAST ACTIVITY =
VAR SELECTEDDATE=MAX('CONSTRUCTION SCHEDULE'[FINISH DATE])
VAR CURRENTSTATUS =MAX('CONSTRUCTION SCHEDULE'[CURRENT STAGE])
RETURN
IF(CURRENTSTATUS == BLANK() || CURRENTSTATUS = "",
VAR LATESTSTATUSDATE =
CALCULATE(
MAX('CONSTRUCTION SCHEDULE'[FINISH DATE]),
'CONSTRUCTION SCHEDULE'[FINISH DATE]<SELECTEDDATE,
'CONSTRUCTION SCHEDULE'[CURRENT STAGE]<> BLANK()
)
RETURN
CALCULATE(
MAX('CONSTRUCTION SCHEDULE'[STAGES]),
'CONSTRUCTION SCHEDULE'[FINISH DATE]=CURRENTSTATUS
),
CURRENTSTATUS
)
 

Thanks!!

 

4 REPLIES 4
Anonymous
Not applicable

Hello @Anonymous 
Change your Current Stage to text format and update the dax.

LAST ACTIVITY =
VAR SELECTEDDATE=MAX('CONSTRUCTION SCHEDULE'[FINISH DATE])
VAR CURRENTSTATUS =MAX('CONSTRUCTION SCHEDULE'[CURRENT STAGE])
RETURN
IF(CURRENTSTATUS == BLANK() || CURRENTSTATUS = "",
VAR LATESTSTATUSDATE =
CALCULATE(
MAX('CONSTRUCTION SCHEDULE'[FINISH DATE]),
'CONSTRUCTION SCHEDULE'[FINISH DATE]<SELECTEDDATE,
'CONSTRUCTION SCHEDULE'[CURRENT STAGE]<> BLANK()
)
RETURN
CALCULATE(
MAX('CONSTRUCTION SCHEDULE'[STAGES]),
'CONSTRUCTION SCHEDULE'[FINISH DATE]= VALUE( CURRENTSTATUS )
),
CURRENTSTATUS
)

If it doesn't work as expected then please share the expected output.
Anonymous
Not applicable

Thanks for your reply TarunSharma.

I tried it but it didn't work.

What I am trying to achieve is to be able to show the Total WIP, Bank Loan and current Stage for each ID at every point in time.

Please see item marked in red in the below table.

STAGES_.png

 

amitchandak
Super User
Super User

@Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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