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! Learn more

Reply
snifer
Post Patron
Post Patron

Calulate previous year value without use function sameperiodlastyear or other functions

this is my data model

 

https://www.dropbox.com/s/x6wtywkor1gdy3q/UpdatingSlicer.pbix?dl=0

 

assuming there will be an extra column in my data model as  "amont" value .

my goal is to calculate the previous year " amount"without using sameperiod last year( or at least i see in my datamodel this will not work, if you find the way to use it let me know),  so i can compare this year sum with previous year values.

 the value will be use with a periood slicer based on column "monthslicer"

my goal is 

1. When I choose the 2019-01, the measure shows sum(value) of 2018-01

2. When I choose the 2019-01 and 2019-02, the measure shows sum(value) of 2018-01 and 2018-02

3. When I choose the 2018-01 and 2018-03, the measure shows sum(value) of 2017-01 and 2017-03

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @snifer ,

 

yes. Please create a seperate Date Table.

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

7 REPLIES 7
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @snifer ,

 

you want this?

 

Amount PY =
CALCULATE ( SUM ( 'Table'[Amount] ); DATEADD ( DimDate[Date]; -1; YEAR ) )

 

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


@mwegener  your solution is not working from my side,just  same as for sameperiod last year 

DATEADD ( DimDate[Date]; -1; YEAR ) )

this because i'm filtering the period with [monthslicer] that is a txt and not with [date] field...the result with your measure is always displaying blank ,

im using the monthslider as period selector in order to have current month selected and  displaying everythime I open a report the currentt months year

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @snifer 

 

check this.

 

PBIX (correct File)

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


@mwegener 

I check your file i can see the measure the check year month is the= today but how I can use in order to make the slicer selected automatically the yes month year today?

mwegener
Most Valuable Professional
Most Valuable Professional

Sorry i upload the wrong file.

 

PBIX

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


@mwegener 

in my model date  and amount are in same table, it might be the reason why is not working for me?

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @snifer ,

 

yes. Please create a seperate Date Table.

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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