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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Matrix visual for YTD vs. Previous Year

Experts,

I am having a scenario, Assume have only one measure and that should show current year YTD i.e June 2023 and Previous Year YTD till June 2022 only. How would I made my measure should show for the Current Year YTD vs. Previous Year YTD in the same measure dynamically? Below is the ssnapshot that my measure is displays the Current Year 2023 YTD is looks good, but for 2022 it is summing till Dec 2022. please help?bmunagapati_1-1690287634951.png

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

Maybe the function SAMEPERIODLASTYEAR could help you.

It returns a table that contains a column of dates shifted one year back in time from the dates in the specified dates column, in the current context.

Besides, you can use something like this:

Measure =
VAR _a =
    MAXX ( ALL ( 'Table'[Date] ), [Date] ) //get the max date 
VAR _b =
    EOMONTH ( _a, -12 ) //end of the same month in last year 
RETURN
    CALCULATE (
        SUM ( [Value] ),
        FILTER ( ALL ( 'Table' ), [Date] <= _b && YEAR ( [Date] ) = YEAR ( _a ) - 1 )
    )

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @amitchandak please help on this, you helped me in multiple work arounds. Thanks 🙂

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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