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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
kajelliott
Helper I
Helper I

Same period last year for Cumulative DAX equation

Anyone have a clue how I can calculate the following DAX equation for the same period last year?

 

Current Est Value = CALCULATE(SUMX(FILTER('table', 'table'[Created On] <=MAX('Calendar'[Date]) && (ISBLANK('table'[Close Date]) || 'table'[Close Date]>MAX('Calendar'[Date]))), ('table'[Est. Revenue])), CROSSFILTER('table'[Created On], 'Calendar'[Date], none))
 
Im at a loss!
 
Thank you 🙂
1 ACCEPTED SOLUTION
v-weiyan1-msft
Community Support
Community Support

Hi @kajelliott ,

 

I am not sure how your semantic model looks like, please try the following code as shown below.

Previous Est Value =
CALCULATE (
    SUMX (
        FILTER (
            'table',
            'table'[Created On] <= MAX ( 'Calendar'[Date] )
                && (
                    ISBLANK ( 'table'[Close Date] )
                        || 'table'[Close Date] > MAX ( 'Calendar'[Date] )
                )
        ),
        ( 'table'[Est. Revenue] )
    ),
    CROSSFILTER ( 'table'[Created On], 'Calendar'[Date], NONE ),
    SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
)

If I've misunderstood you, please provide detailed sample data and the results you are hoping for. We can better understand the problem and help you. Show it as a screenshot or excel. Please remove any sensitive data in advance.

 

Best Regards,
Yulia Yan

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

4 REPLIES 4
v-weiyan1-msft
Community Support
Community Support

Hi @kajelliott ,

 

I am not sure how your semantic model looks like, please try the following code as shown below.

Previous Est Value =
CALCULATE (
    SUMX (
        FILTER (
            'table',
            'table'[Created On] <= MAX ( 'Calendar'[Date] )
                && (
                    ISBLANK ( 'table'[Close Date] )
                        || 'table'[Close Date] > MAX ( 'Calendar'[Date] )
                )
        ),
        ( 'table'[Est. Revenue] )
    ),
    CROSSFILTER ( 'table'[Created On], 'Calendar'[Date], NONE ),
    SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
)

If I've misunderstood you, please provide detailed sample data and the results you are hoping for. We can better understand the problem and help you. Show it as a screenshot or excel. Please remove any sensitive data in advance.

 

Best Regards,
Yulia Yan

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

I believe this worked, thank you!

DallasBaba
Skilled Sharer
Skilled Sharer

@kajelliott  you can use the SAMEPERIODLASTYEAR function. Modify your DAX formula as follows:

SamePeriodLastYear Est Value =
CALCULATE(
    SUMX(
        FILTER(
            ALL('table'),
            'table'[Created On]
                >= SAMEPERIODLASTYEAR(MAX('Calendar'[Date]))
                && (ISBLANK('table'[Close Date]) || 'table'[Close Date] > SAMEPERIODLASTYEAR(MAX('Calendar'[Date])))
        ),
        'table'[Est. Revenue]
    ),
    CROSSFILTER('table'[Created On], 'Calendar'[Date], NONE)
)
Let me know if this works for you. @ me in replies, or I'll lose your thread!!!  
Note:
If this post is helpful, please mark it as the solution to help others find it easily. Also, if my answers contribute to a solution, show your appreciation by giving it a thumbs up
Thanks
Dallas

@DallasBaba - thanks for your suggestion!

 

Coming up with an error around the calendar date when SAMEPERIODLASTYEAR is included in the expression.

 

kajelliott_0-1706163240502.png

Error states 'The first argument to 'SAMEPERIODLASTYEAR' must specify a column'

 

Any thoughts?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.