cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rve
New Member

Previous Year Price Comparison Without Summing

Hi All,

 

I have a table that has three columns:

1. Region

2. Date 

3. Price

 

I am looking to create a new table with the previous year's price on it so I can do a YoY change.  How do I do this when I need to filter on the previous year and the specific region?

 

I tried this and it didnt work

PY Ibase = if (YEAR(InstallBase[Date])=2014, 0, Calculate (SUM(InstallBase[Ibase]), DATEADD('Date'[Date], -1, YEAR), InstallBase[GeoID]=4))

 

Thanks

2 ACCEPTED SOLUTIONS
v-ljerr-msft
Microsoft
Microsoft

@rve

 

According to your description, the following formulas should meet your requirement.

PY_Price = 
CALCULATE (
    SUM ( MyTestTable[Price] ),
    SAMEPERIODLASTYEAR ( MyTestTable[Date] ),
    ALLEXCEPT ( MyTestTable, MyTestTable[Region] )
)

Or

PY_Price_2 = 
CALCULATE (
    SUM ( MyTestTable[Price] ),
    DATEADD( MyTestTable[Date], -1, YEAR),
    ALLEXCEPT ( MyTestTable, MyTestTable[Region] )
)

The following sample is for your reference:

Assume we have a table called MyTestTable with 3 columns(Region, Date, Price).

py01.PNG

Then we can use the formula I mentioned above to create a measure, and use the measure to show YOY Price change with filter of Date and Region in the report.

py02.PNG

 

 

Regards

View solution in original post

rve
New Member

I have a table with three columns.  Price, date and region.  I want to do a year over year comparison on price.  I don't want to sum the price, but just compare.

 

How do I create a new column that takes the previos years price and compares it to this year for each region?

 

I tried:

PY Ibase = if (YEAR(InstallBase[Date])=2014, 0, Calculate (SUM(InstallBase[Ibase]), DATEADD('Date'[Date], -1, YEAR), InstallBase[GeoID]=4))  

View solution in original post

3 REPLIES 3
v-ljerr-msft
Microsoft
Microsoft

@rve

 

According to your description, the following formulas should meet your requirement.

PY_Price = 
CALCULATE (
    SUM ( MyTestTable[Price] ),
    SAMEPERIODLASTYEAR ( MyTestTable[Date] ),
    ALLEXCEPT ( MyTestTable, MyTestTable[Region] )
)

Or

PY_Price_2 = 
CALCULATE (
    SUM ( MyTestTable[Price] ),
    DATEADD( MyTestTable[Date], -1, YEAR),
    ALLEXCEPT ( MyTestTable, MyTestTable[Region] )
)

The following sample is for your reference:

Assume we have a table called MyTestTable with 3 columns(Region, Date, Price).

py01.PNG

Then we can use the formula I mentioned above to create a measure, and use the measure to show YOY Price change with filter of Date and Region in the report.

py02.PNG

 

 

Regards

View solution in original post

This worked!

rve
New Member

I have a table with three columns.  Price, date and region.  I want to do a year over year comparison on price.  I don't want to sum the price, but just compare.

 

How do I create a new column that takes the previos years price and compares it to this year for each region?

 

I tried:

PY Ibase = if (YEAR(InstallBase[Date])=2014, 0, Calculate (SUM(InstallBase[Ibase]), DATEADD('Date'[Date], -1, YEAR), InstallBase[GeoID]=4))  

View solution in original post

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors