Share via

Power Pivot SAMEPERIODLASTYEAR

Anonymous
2019-10-09T15:45:01+00:00

I've got this pivot (below).  Data is from 1/1/2018 and later.  Using SAMEPERIODLASTYEAR function, I get the expected results for Total Quantity Previous Year in column D.  2018 values are blank as expected because there is no 2017 data.  Same logic applied to column G, but I get 105,131.97 for a 2018 value when I expected blanks.  That number is the amount on the specific date 1/1/2018.

Formula looks like this:  =CALCULATE([Total Quantity 3MM Avg],SAMEPERIODLASTYEAR(dimCALENDAR[Date])).

Why can't I get those blanks to appear in column G like I can in column D?

![](https://learn-attachment.microsoft.com/api/attachments/51302e8b-da44-41ff-a5af-2ec28c09332f?platform=QnA

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Ashish Mathur 102K Reputation points Volunteer Moderator
2019-10-11T00:08:20+00:00

Hi,

One simple way out is to use this measure for Total Quantity 3MM PY Avg (see column F in the image below).

=if(ISBLANK([Total Quantity PY]),BLANK(),CALCULATE([Total Quantity 3MM Avg],SAMEPERIODLASTYEAR(dimCALENDAR[Date])))

Do the same for the Cost measure as well

Hope this helps.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2019-10-11T15:58:02+00:00

    Perfect, thank you!

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2019-10-10T14:43:49+00:00

    Worksheet called PivotTable is where you can see the issue in pivot table format.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2019-10-10T14:41:28+00:00

    Was this answer helpful?

    0 comments No comments
  4. Ashish Mathur 102K Reputation points Volunteer Moderator
    2019-10-09T23:35:20+00:00

    Hi,

    Share the link from where I can download the Excel file.

    Was this answer helpful?

    0 comments No comments