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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Count days.

Hello everyone!

 

I have a data base with all information of the contrats of the purchase coordination. All those contrats have an expiring date. I need to create a visual that counts how many days we are without an expired contract. For example, let's say yesterday was the last day with an expired contract, and the analyst finalyzed it, so today would be "1 day", tomorrow "2 days", ..., "3 days". And if a contract expire, the score goes to 0. 

 

I'm not sure if I was clear...

 

Thanks!

3 REPLIES 3
amitchandak
Super User
Super User

 Try Like

Days since last expire =
Var _last_expire = calculate(maxx(filter(contract,contract[maxdate]<today()), contract[maxdate]),all(contract[maxdate]))
Return
datediff(_last_expire, today(),DAY)

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

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

Thanks for the support! It didnt work, but I think it's almost there...

 

The thing is, if the contract has been finalyzed before the expiring date, it's ok, this should not be considered. But if the contract is expired but not concluded, or it was finalyzed after the expiring date, this should be considered in the days score.

 

 

Anonymous
Not applicable

Another thing, I would like to start counting from 01/01/2020, than when some of the 2 conditions happens, the score starts from 0.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.