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
AzJackson
New Member

Caluate days between days witha including a today variable

Hello,

 

Need help with a formula for a measure please.

My data has two date columns, Start Date, Closed Date.

The start date allways has a date in it

The closed date will not have a date in it untill the data sourse is updated with a closed date.

 

So if there is no closed data what I would like for the measure to do is calucate the number of days between Start and Today for each row of data once there is a date entered in the field I would like to caluate the number of days between Start and Closed.

 

Baiscally trying to create a visual that shows number of records that have or are still exceeding a 28 day target 

 

Thanks for any help

2 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@AzJackson add a new column using the following logic

 

Number of Days = DATEDIFF ( Table[Start Date], COALEASCE ( Table[End Date], TODAY () ), DAY )

 

Follow us on LinkedIn and  to our YouTube channel

I would  Kudos if my solution helped. If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

ADPowerBI1
Responsive Resident
Responsive Resident

DATEDIFF([Start Date],IF(ISBLANK(Closed Date) = TRUE(),NOW(),[Closed Date]),DAY)

 

Try this.

 

It's saying "Get the date difference in days between start date and closed date, if the closed date is blank, use today's date".

Let me know if this works. Kind regards.

View solution in original post

4 REPLIES 4
ADPowerBI1
Responsive Resident
Responsive Resident

DATEDIFF([Start Date],IF(ISBLANK(Closed Date) = TRUE(),NOW(),[Closed Date]),DAY)

 

Try this.

 

It's saying "Get the date difference in days between start date and closed date, if the closed date is blank, use today's date".

Let me know if this works. Kind regards.

Create a calculated column using this, not a measure by the way. Good luck!

parry2k
Super User
Super User

@AzJackson add a new column using the following logic

 

Number of Days = DATEDIFF ( Table[Start Date], COALEASCE ( Table[End Date], TODAY () ), DAY )

 

Follow us on LinkedIn and  to our YouTube channel

I would  Kudos if my solution helped. If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks both the above work

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.