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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Same period last year

Hi everybody,

 

can someone help me about this please ? 

 

I would like to have this measure with the same period but the year before ? How can I do this ? 

 

CA = CALCULATE(-SUM(G_L[Amount]),
filter(G_L,
(G_L[G_L Account No_]>=700000 && G_L[G_L Account No_]<=709999)
&& NOT(G_L[Global Dimension 1 Code])IN{"901Admin","911IT","921Fin","931Dir","941Mkt","902HORSEXPL"}),
DATESBETWEEN(Calendrier[Date],date(year(today()),1,1),FIRSTDATE(Clotures[Date Clôture])))
 
Thanks for your help.
1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

You could try using the EDATE function to return last year's date,

EDATE

Returns the date that is the indicated number of months before or after the start date. Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.

Try this measure:

 

CA =
CALCULATE (
    - SUM ( G_L[Amount] ),
    FILTER (
        G_L,
        ( G_L[G_L Account No_] >= 700000
            && G_L[G_L Account No_] <= 709999 )
            && NOT ( G_L[Global Dimension 1 Code] )
            IN { "901Admin", "911IT", "921Fin", "931Dir", "941Mkt", "902HORSEXPL" }
    ),
    DATESBETWEEN (
        Calendrier[Date],
        EDATE ( DATE ( YEAR ( TODAY () ), 1, 1 ), -12 ),
        EDATE ( FIRSTDATE ( Clotures[Date Clôture] ), -12 )
    )
)

 

Or, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.

 

And it' s not possible to do so with only one measure and to put a year column in a matrix to make both data appear.  If you wish to show a comparison between this year and the same period last year, then you will need two measures to calculate this year and the same period last year separately.

The calculation group looks like there is only one measure, but the calculation group contains more than one measure, maybe it is what you want.

 

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
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-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

You could try using the EDATE function to return last year's date,

EDATE

Returns the date that is the indicated number of months before or after the start date. Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.

Try this measure:

 

CA =
CALCULATE (
    - SUM ( G_L[Amount] ),
    FILTER (
        G_L,
        ( G_L[G_L Account No_] >= 700000
            && G_L[G_L Account No_] <= 709999 )
            && NOT ( G_L[Global Dimension 1 Code] )
            IN { "901Admin", "911IT", "921Fin", "931Dir", "941Mkt", "902HORSEXPL" }
    ),
    DATESBETWEEN (
        Calendrier[Date],
        EDATE ( DATE ( YEAR ( TODAY () ), 1, 1 ), -12 ),
        EDATE ( FIRSTDATE ( Clotures[Date Clôture] ), -12 )
    )
)

 

Or, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.

 

And it' s not possible to do so with only one measure and to put a year column in a matrix to make both data appear.  If you wish to show a comparison between this year and the same period last year, then you will need two measures to calculate this year and the same period last year separately.

The calculation group looks like there is only one measure, but the calculation group contains more than one measure, maybe it is what you want.

 

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Thanks @amitchandak , but is it possible to do so with only one measure and to put a year column in a matrix to make both data appear ? 

amitchandak
Super User
Super User

@Anonymous , Try

 


var _dt = FIRSTDATE(Clotures[Date Clôture])
return
CA = CALCULATE(-SUM(G_L[Amount]),
filter(G_L,
(G_L[G_L Account No_]>=700000 && G_L[G_L Account No_]<=709999)
&& NOT(G_L[Global Dimension 1 Code])IN{"901Admin","911IT","921Fin","931Dir","941Mkt","902HORSEXPL"}),
DATESBETWEEN(Calendrier[Date],date(year(today())-1,1,1),Date(Year(_dt)-1, month(_dt), day(_dt) )))

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
Anonymous
Not applicable

I guess it is not possible to do so with only one measure and to put a year column in a matrix to make both data appear ? 

Helpful resources

Announcements
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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

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