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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
enmnm
New Member

Power Pivot Measure to calculate days between two dates for each category

I hope I am in the correct forum. I have an excel table that I have loaded into my data model. The topic is, say butterflies.

The "Stage" column is a calculated column using an If statement and based on the last isblank cell. What I would like to do is to write a measure that calculates the StageDays based on Stage--which would be today - the last filled-in-date. Can you help me figure out how to do this? Thanks.

 

SpecimenEggDateLarveDatePupeDateStageStageDays
012454/6/20235/7/20236/3/2023Pupe 
03572/4/2023  Egg 
09342/9/20235/6/2023 Larve 
      
      
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

If you want to keep your data in Excel you will have to hard code the order of the column checks.

 

In Power BI we would ask you to unpivot your data, and to provide a reference table with the stage sequence index.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

If you want to keep your data in Excel you will have to hard code the order of the column checks.

 

In Power BI we would ask you to unpivot your data, and to provide a reference table with the stage sequence index.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.