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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
GhadaMehrez
Helper III
Helper III

Create measure calculate the number of months between the End Date and Today

I want to calculate the number of months between the End Date and Today (Month remains to today) any help please  to add a measure for that 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @GhadaMehrez ,

 

Answer for 1: you can format  "End Date" by format() function

Format_Enddate =
FORMAT ( 'Table'[End Date], "dd-mmm-yyyy" )

vbinbinyumsft_0-1659429752095.png

 

Differ_to_Today =
VAR cur_date =
    TODAY ()
VAR cur_enddate =
    SELECTEDVALUE ( 'Table'[Format_Enddate] )
RETURN
    DATEDIFF ( cur_enddate, cur_date, MONTH )

vbinbinyumsft_1-1659429825784.png

Answer for 2: I guess your Y Axis field may sum by default, please try to select "Don't summarize"

vbinbinyumsft_2-1659430869072.png

Best regards,
Community Support Team_ Binbin Yu
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

7 REPLIES 7
Anonymous
Not applicable

Hi @GhadaMehrez ,

Please try below dax formula:

 

Differ_to_Today =
VAR cur_date =
    TODAY ()
VAR cur_enddate =
    SELECTEDVALUE ( 'Table'[End Date] )
RETURN
    DATEDIFF ( cur_enddate, cur_date, MONTH )

 

vbinbinyumsft_0-1658908012623.png

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Perfect but some issues as:

1- Passed end date shown as below, it should appear in minus (-).

2- in the dashboard still does not appear I don't know thy reason.

GhadaMehrez_0-1658915601558.png

GhadaMehrez_1-1658915706064.png

 

Thanks for your help

Anonymous
Not applicable

Hi @GhadaMehrez ,

 

Answer for 1: you can format  "End Date" by format() function

Format_Enddate =
FORMAT ( 'Table'[End Date], "dd-mmm-yyyy" )

vbinbinyumsft_0-1659429752095.png

 

Differ_to_Today =
VAR cur_date =
    TODAY ()
VAR cur_enddate =
    SELECTEDVALUE ( 'Table'[Format_Enddate] )
RETURN
    DATEDIFF ( cur_enddate, cur_date, MONTH )

vbinbinyumsft_1-1659429825784.png

Answer for 2: I guess your Y Axis field may sum by default, please try to select "Don't summarize"

vbinbinyumsft_2-1659430869072.png

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@GhadaMehrez ,

 

A measure like

Sumx(Table, Datediff([End Date], Today(), Day())

 

or

 

AverageX(Table, Datediff([End Date], Today(), Day())

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

I adjusted it as follows but still, nothing appear in the dashboard also due end date not as -number

 

# of Months = SUMX(IncrementalImprovement, Datediff([fls_ActualEndDate], TODAY(), DAY)
GhadaMehrez_0-1658948312259.png

 

@amitchandak any idea please as the data not appear in the dashboard when I add the x-axis of the measure also passed end dates not show as (-)

 

GhadaMehrez_0-1659272232418.png

 

It is not working 
GhadaMehrez_0-1658920204416.png

 

 

no of month = Sumx(IncrementalImprovement, Datediff([fls_ActualEndDate], Today(), Day())​

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors