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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
DouglasRoubaud
Frequent Visitor

Create Column - Previous Year (Dax or Power Query)

I have a base with 3 years of history and I would like to create a column with the same period of the previous year... Aiming to hit line by line (of the same date), without having to place the date column in the visual (the same table).

 

DouglasRoubaud_0-1638444400766.png

 

In short, it is taking the date without losing this mapping between the same dates and dates.

Can you help me with the best procedure to do creating this column? 

 

Thanks!

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi  @DouglasRoubaud ,

Tty to use the following dax to create a new column:

previousvalue = 
CALCULATE (
    MAX ( 'Table'[Value] ),
    FILTER (
        ALL ( 'Table' ),
        YEAR ( 'Table'[Date] )
            = YEAR ( EARLIER ( 'Table'[Date] ) ) - 1
            && MONTH ( 'Table'[Date] ) = MONTH ( EARLIER ( 'Table'[Date] ) )
            && DAY ( 'Table'[Date] ) = DAY ( EARLIER ( 'Table'[Date] ) )
    )
)

Get:

vluwangmsft_0-1638845172301.png

Final create visual:

vluwangmsft_1-1638845185232.png

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi  @DouglasRoubaud ,

Tty to use the following dax to create a new column:

previousvalue = 
CALCULATE (
    MAX ( 'Table'[Value] ),
    FILTER (
        ALL ( 'Table' ),
        YEAR ( 'Table'[Date] )
            = YEAR ( EARLIER ( 'Table'[Date] ) ) - 1
            && MONTH ( 'Table'[Date] ) = MONTH ( EARLIER ( 'Table'[Date] ) )
            && DAY ( 'Table'[Date] ) = DAY ( EARLIER ( 'Table'[Date] ) )
    )
)

Get:

vluwangmsft_0-1638845172301.png

Final create visual:

vluwangmsft_1-1638845185232.png

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

negi007
Community Champion
Community Champion

@DouglasRoubaud  you can create a measure to calc previous year value like below

 

Value_LY = CALCULATE(SUM('Table'[value]),DATEADD('Table'[date],-1,DAY))
 
and then create your visual like below
 
negi007_0-1638445859075.png

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors