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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

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


View solution in original post

7 REPLIES 7

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


@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

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


@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?

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


@mwegener 

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

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


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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