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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
rtmarquee
Frequent Visitor

Dax future time period

Working with time periods, I have what I want for the past, but how can I add in future? Looking for Next 90 days, etc
Current dax

 
Time Periods =
var _today =
    MAX ( 'Date Refresh'[Date])
var _thisyear =
    YEAR ( _today )
var _thismonth =
    MONTH ( _today )
var _thisday =
    DAY ( _today )
return
    SELECTCOLUMNS(
        UNION(
            //Yesterday
            ADDCOLUMNS(
                GENERATE(
                    SELECTCOLUMNS( {"Yesterday"}, "Period", [Value] ),
                    GENERATESERIES(DATE(_thisyear, _thismonth, _thisday -1), _today -1)
                ),
                "Axis Date", [Value]
            ),
            //Last30Days
            ADDCOLUMNS(
                GENERATE(
                    SELECTCOLUMNS( {"Last 30 Days"}, "Period", [Value] ),
                    GENERATESERIES(DATE(_thisyear, _thismonth, _thisday -30), _today -1)
                ),
                "Axis Date", [Value]
            ),
            //Last60Days
            ADDCOLUMNS(
                GENERATE(
                    SELECTCOLUMNS( {"Last 60 Days"}, "Period", [Value] ),
                    GENERATESERIES(DATE(_thisyear, _thismonth, _thisday -60), _today -1)
                ),
                "Axis Date", [Value]
            ),
            //Last90Days
            ADDCOLUMNS(
                GENERATE(
                    SELECTCOLUMNS( {"Last 90 Days"}, "Period", [Value] ),
                    GENERATESERIES(DATE(_thisyear, _thismonth, _thisday -90), _today -1)
                ),
                "Axis Date", [Value]
            ),
            //LastMonth
            ADDCOLUMNS(
                GENERATE(
                    SELECTCOLUMNS( {"Last Month"}, "Period", [Value] ),
                    GENERATESERIES(DATE (_thisyear, _thismonth -1, 1), EOMONTH( _today,-1) )
                ),
                "Axis Date", [Value]
            )
        ),
        "Date", [Value],
        "Period", [Period],
        "Axis Date", [Axis Date]
    )
3 REPLIES 3
tamerj1
Super User
Super User

Hi @rtmarquee 

would you please asvise the expected result of this table?

The dax above is working as intended. Ideally I would like to be able to add to this dax to also get a selection in the column for the next 90 days, next 6 months, and next year. In our business we enter orders in to our ERP and alot of our business is in the future, so this would help us with projecting for time periods. Thanks!

A rolling time period would be helpful too!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors