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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

DATEADD and min function DAX

hi community 

i was hoping someone can help me figure out below 

 

what i want to do is , for each week_start period, i want to bring the minimum of date_update add 13 weeks to it (182 days) and bring the value for that.

 

example for week start 8/8/2022 , i want to bring value of date_update 16/05/2022 which is 11572. and so on ....

 

so everyweek that i have new row of data , it goes back to fine the new min date and add 182 days to it and give me the value 

 

Postanalytics_0-1654493181408.png

 

i created totalf = SUM(MYDATA[FORECAST_VALUE])

so i thought i can use dateadd function and bring the minimum date_updated and add 182 days to it 

mindate = min(dateadd(MYDATA[DATE_UPDATE] , 182, DAY))

thanks 

1 ACCEPTED SOLUTION

Hi, @Anonymous 

Please try formula as below:

Measure =
VAR mindate =
    CALCULATE ( MIN ( 'myData'[DATE_UPDATE] ), ALL ( 'myData' ) )
RETURN
    CALCULATE (
        SUM ( 'myData'[FORECAST_VALUE] ),
        FILTER ( 'myData', 'myData'[DATE_UPDATE] = min_date )
    )

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , You can simply do it like

 

min(MYDATA[DATE_UPDATE]) + 182

 

Date as Dateadd - Decoding Date and Calendar 5-5 - Power BI Turning 5 Celebration Series
https://community.powerbi.com/t5/Community-Blog/Date-as-Dateadd-Decoding-Date-and-Calendar-5-5-Power-BI-Turning/ba-p/1187827

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

thanks for your reply 

i tried this 

 

forecastvalue = var min_date = min(myData[DATE_UPDATE])+182
var forecastv = CALCULATE(SUM(myData[FORECAST_VALUE]) ,myData[DATE_UPDATE] = min_date)
Return forecastv
 
and it does not return any values 
 
Postanalytics_0-1654507904909.png

 

what i really want to return from all the values for week_start 8/8/2022 is value of 11572 which happend on date_update 16/05/2022

 

Postanalytics_1-1654507999696.png

 

Hi, @Anonymous 

Please try formula as below:

Measure =
VAR mindate =
    CALCULATE ( MIN ( 'myData'[DATE_UPDATE] ), ALL ( 'myData' ) )
RETURN
    CALCULATE (
        SUM ( 'myData'[FORECAST_VALUE] ),
        FILTER ( 'myData', 'myData'[DATE_UPDATE] = min_date )
    )

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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