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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.