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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
biswad
Advocate I
Advocate I

Calculate dates in a month based on 22nd as start date.

Hi All, 

I have a table which has dates column ( screenshot attached), I would like to calculate number of days in a month based on 22nd as start date. For example today is 8th Oct, so the total should be 16 . Any help on how can I achieve this would be greatly appriciated

 

biswad_0-1728382616842.png

 

 

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Thanks for the reply from suparnababu8  and Kedar_Pande , please allow me to provide another insight:

Hi  @biswad ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _today=TODAY()
var _endday=
DATE(
    YEAR(_today),MONTH(_today),22)
return
DATEDIFF(
    _today,_endday,DAY)+2

2. Result:

vyangliumsft_0-1728465142039.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

6 REPLIES 6
v-yangliu-msft
Community Support
Community Support

Thanks for the reply from suparnababu8  and Kedar_Pande , please allow me to provide another insight:

Hi  @biswad ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _today=TODAY()
var _endday=
DATE(
    YEAR(_today),MONTH(_today),22)
return
DATEDIFF(
    _today,_endday,DAY)+2

2. Result:

vyangliumsft_0-1728465142039.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Thank you this works for me ,
Kedar_Pande
Super User
Super User

Create a Measure:

DaysLeftInMonth =
VAR CurrentDate = TODAY()
VAR StartDate = DATE(YEAR(CurrentDate), MONTH(CurrentDate), 22)
VAR EndDate = EOMONTH(StartDate, 0)

RETURN
IF(CurrentDate < StartDate,
0,
DATEDIFF(StartDate, EndDate, DAY)
)

 

Thank you for your help, but I'm getting zero days. So, basically I wanted to count number of days between today and 10/22/2024 ( Which is in the dates column)

Hi @biswad  

 

DaysleftMeasure = 
VAR CurrentDate = MAX([CalenderDateColumn])
VAR StartDate = IF(DAY(CurrentDate) >= 22, DATE(YEAR(CurrentDate), MONTH(CurrentDate), 22), DATE(YEAR(CurrentDate), MONTH(CurrentDate) - 1, 22))
RETURN 
DATEDIFF(StartDate, CurrentDate, DAY)

Try with this. Let me know If it works 

Thank you for your reply, I'm still getting zero days. 

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors