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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

DATEADD from another measure

Hello!

I need to generate a formula that brings me the minimum date of a column, minus 3 months.

Generate a calculated measure to bring back the oldest date (MIN). That's what I wanted to apply a Dateadd to, but since it's not a date table, it doesn't allow me to generate the formula.

Thank you very much from now, I hope you have understood what I am looking for.

Best regards.

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

Hi @Verosb ,

You can create a measure as below to get it, please find the details in the attachment.

3 months before Mindate = 
VAR _mindate =
    CALCULATE ( MIN ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
VAR _premonth =
    EOMONTH ( _mindate, -3 )
VAR _minday =
    DAY ( _mindate )
VAR _preday =
    DAY ( _premonth )
RETURN
    IF (
        _minday > _preday,
        _premonth,
        DATE ( YEAR ( _premonth ), MONTH ( _premonth ), DAY ( _mindate ) )
    )

yingyinr_1-1669615069230.png

Best Regards

Community Support Team _ Rena
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

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @Verosb ,

You can create a measure as below to get it, please find the details in the attachment.

3 months before Mindate = 
VAR _mindate =
    CALCULATE ( MIN ( 'Table'[Date] ), ALLSELECTED ( 'Table' ) )
VAR _premonth =
    EOMONTH ( _mindate, -3 )
VAR _minday =
    DAY ( _mindate )
VAR _preday =
    DAY ( _premonth )
RETURN
    IF (
        _minday > _preday,
        _premonth,
        DATE ( YEAR ( _premonth ), MONTH ( _premonth ), DAY ( _mindate ) )
    )

yingyinr_1-1669615069230.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Shaurya
Memorable Member
Memorable Member

Hi @Syndicate_Admin,

 

You can use:

 

Min Date Minus 3 Months = DATE(YEAR(MIN('Table'[Date])),MONTH(MIN('Table'[Date]))-3,DAY(MIN('Table'[Date])))

 

Works for you? Mark this post as a solution if it does!
Check out this blog of mine: How to Export Telemetry Data from Azure IoT Central into Power BI

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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