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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
nev
Frequent Visitor

Calculate using PriorYear but dont display future

I have a chart that displays monthly values, then a comparison bar from the same period last year,

It uses the following formula to get the prior year:

Prior Year Revenue = CALCULATE(SUM('V_AU ALR Cost and Qty'[Amount (LCY)])*-1, SAMEPERIODLASTYEAR('Gen Date Table'[Date]))

 

Now the problem is that it is displaying this year's values in next year, so even though we are in 2017, it is displaying this year's values in 2018 (In preparation for them being the prior year to that year's actuals)

 

I want to remove these values, everything greater than this month would be great, as the first stepI have tried to remove them by adding a filter to my calculate, but it has no effect at all, I get the same result as the original above:

Prior Year Revenue = CALCULATE(SUM('V_AU ALR Cost and Qty'[Amount (LCY)])*-1, SAMEPERIODLASTYEAR('Gen Date Table'[Date]), 'Gen Date Table'[Date]<= TODAY())

 

Any Ideas?

4 REPLIES 4
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @nev,

 

What is the unexpected result you get? I cannot image what did you mean "it is displaying this year's values in next year, so even though we are in 2017, it is displaying this year's values in 2018". Please share your sample data and screenshot of current output to elaborate your scenario.

 

Below is the my test, hope it helpful to your scenario.

 

Data view and relationship between source table and date table.

1.PNG3.PNG

 

Measures.

Current year =
CALCULATE (
    SUM ( 'V_AU ALR Cost and Qty'[Amount (LCY)] ),
    'V_AU ALR Cost and Qty'[Year] = YEAR ( TODAY () )
)

Prior Year Revenue =
CALCULATE (
    SUM ( 'V_AU ALR Cost and Qty'[Amount (LCY)] ),
    SAMEPERIODLASTYEAR ( 'Gen Date Table'[Date] )
)

Then, in chart visual:

Axis - enter Date hierarchy  from date table (in your scenario, it's 'Gen Date Table')

 


Value - enter the above two measure: [Current year] and [Prior Year Revenue]

 

2.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the response, the image of the problem chart is below, in the picture the normal sum is the light colour, and the dark colour is the formula for getting the prior year value.

 

As you can see the current year has both the value and the prior year value, but beyond today, the "Prior Year" values are still showing up, I want to filter this chart so that no values are shown for next month onwards.

 

Hope this makes sense?

 

https://1drv.ms/i/s!AsT0oct8oHb9gvwP2bmPaJsLRimakw

 

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @nev,

 

What is your sample data?

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Sorry, I don't have sample data, only production data from their live system which I cannot share.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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