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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Berl21
Helper III
Helper III

Filtering the number of days between today and a specific date

Hi,

 

I need to obtain the following number as a measure for me to do some additional calculations: number of days between today and a specific date within the data set.

I have added a calculated column in my date calendar to get the time difference in days between today and all the available days. Then I made another column with a marker for the date I have to take into account (not the first or last date of the dataset, so I can't use MIN or MAX as a get around). 

I can make a card with this as long as I use an additional filter to the visual (filter set on the 2nd column I mentioned). To get the same number as a measure, I thought I could use the following filter:

Berl21_0-1661185468492.png

The error message I get doesn't make sense as of now. 

How can I get around this?

Thanks,

 

Pauline.

1 ACCEPTED SOLUTION
Berl21
Helper III
Helper III

@johnt75 I tried this just now but it doesn't seem to work. 

However, I did find the solution just now as well. It is way easier than all I could think of 😄 

 

Days since official start =

 

CALCULATE(
COUNTROWS(
DATESBETWEEN(DateTable[DayDate], DATE(2022,04,20), TODAY()
)))



View solution in original post

2 REPLIES 2
Berl21
Helper III
Helper III

@johnt75 I tried this just now but it doesn't seem to work. 

However, I did find the solution just now as well. It is way easier than all I could think of 😄 

 

Days since official start =

 

CALCULATE(
COUNTROWS(
DATESBETWEEN(DateTable[DayDate], DATE(2022,04,20), TODAY()
)))



johnt75
Super User
Super User

I think you could use

# of days =
VAR startDate =
    CALCULATE ( SELECTEDVALUE ( 'Date'[Date] ), 'Date'[Start date] = "Start date" )
RETURN
    DATEDIFF ( startDate, TODAY (), DAY )

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.