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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
vanessafvg
Super User
Super User

Previous year calculations bring back current year values :/ - help

I posted this in another thread but highlighted the issue of it not plotting correctly on a line graph - however the issue actually is both of these calcutions ie

 

 

PY Revenue = CALCULATE([Revenue], SAMEPERIODLASTYEAR(all('Fiscal Date'[Date])))

PY 2 = CALCULATE([Revenue], PARALLELPERIOD(ALL('Fiscal Date'[Date]), -1, YEAR))

 

bring back exaclty the same data as this

Revenue = (CALCULATE(Sum(Registrations[MRR])) + CALCULATE(sum(Sales[RevenueNettAmount])))

 

what am i doing wrong, could this be a cross fact issue.  I have 2 facts linking  together through dimensions.  However its only the date dimension that is the linking bit for these 2 which has a one to many relationship for each fact in a single direction.

 

 bullet chart.PNG

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




15 REPLIES 15
mattbrice
Solution Sage
Solution Sage

Remove the ALL function call inside the SAMEPERIODLASTYEAR and PARALLELPERIOD calls.  

i had that previously but it brings back nothing - its because i have this filter on my dashboardCapture.PNG

 

this is what i have changed to 

PY Revenue = CALCULATE([Revenue], SAMEPERIODLASTYEAR('Fiscal Date'[Date]))

PY 2 = CALCULATE([Revenue], PARALLELPERIOD('Fiscal Date'[Date], -1, YEAR))

and as you can see now its empty when i change this, i am baffled... 

 

 Capture.PNG

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Does your 'Fiscal Date' have dates in it for the prior fiscal year(it must for time intelligence to work)? Is your 'Fiscal Date' calendar table related to the fact table via columns of type Date?   if not, can you try this:

 

PY Revenue = CALCULATE([Revenue], SAMEPERIODLASTYEAR('Fiscal Date'[Date]), ALL('Fiscal Calendar') )

that definitely shifted something however my measures are behaving different,  rushing off to a weekend away will figure it out monday, thanks for the help!





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




@vanessafvg Is the issue solved now?

 

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

no 😞  trying a variety of things but its just not working - i really can't figure out what i am doing wrong, just throwing in things now to see what i might be doing wrong.

 

Revenue = (CALCULATE(Sum(Registrations[MRR])) + CALCULATE(sum(Sales[RevenueNettAmount]))) - this is the base calculation

PY Revenue = CALCULATE([Revenue], SAMEPERIODLASTYEAR('Fiscal Date'[TheDate].[Date]), ALL('Fiscal Date') )

PY 2 = CALCULATE([Revenue], SAMEPERIODLASTYEAR('Fiscal Date'[TheDate].[Date]), 'Fiscal Date'[Calendar Year] )

PY 3 = CALCULATE([Revenue], PARALLELPERIOD(all('Fiscal Date'[TheDate].[Date]), -1, YEAR))

 

 


Capture.PNG

 

I do have a filter on the page which is only looking at the current fiscal year, but there is definitely data in my model that stretches back beyond the fiscal year which i thought the ALL would resolve.   It does resolve it in PY Revenue however it doens't bring it back per day it just flat lines it in one aggregaton for all time.

 

Dont know if this makes sense?

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




I remember this problem from your other thread. I think this must be related to the relationships you have set up.

 

Can you share the .pbix file (or en extract from it?). Without that it's hard to troubleshoot.

no unfortunately i can't. but i can tell you that i have 2 fact tables (if you look at the revenue measure its the combination of  a measure from these 2 facts), both fact tables have a  single many to one relationship with the date in fiscal date

 

 Capture.PNG





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Are you able to get it working ok by using revenues from just one table? 

 

For example:

 

Revenue = sum(Sales[RevenueNettAmount])

PY Revenue = CALCULATE([Revenue], SAMEPERIODLASTYEAR('Fiscal Date'[TheDate]))

 

Can you also post a screenshot of the Manage Relationships window?

now it brings back nothing 🙂 if i put all in, it just duplicated the revenue figure

 

banking confirmation.PNG





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hmm - ok, so the last thing I would check before giving up (!) is the date field. 

 

Can you try creating a new date table. You could do a quick one by clicking on Modeling > New Table, then enter:

 

Calendar = 
CALENDAR (DATE(2010,1,1), DATE(2017,12,31))

Then create a relationship between this date field and your date field in the Sales table. 

 

On a new page, drag this new Date field to a Table Visualization, and drag the Revenue and PY Revenue measures to the same table. Remove all filters. 

 

Does that show anything for PY Revenue?

thanks

i added the table.  I also removed all links to all other tables and only joined sales to the new calendar table.  

Revenue = CALCULATE(sum(Sales[RevenueNettAmount])) 

PY Revenue = CALCULATE([Revenue], SAMEPERIODLASTYEAR('Calendar'[Date]))

PY2 Revenue = CALCULATE([Revenue], PARALLELPERIOD('Calendar'[Date],-1,YEAR)) (gave the same results)

 

 

Capture.PNG





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Ah, ok. So you have some missing dates in the Sales table. Can you Edit Queries and filter those blanks out?

thats a good point, ill give that a bash, i did post the manage relationships, in the last post.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




vanessafvg
Super User
Super User

cant believe no one can help with these - anyone?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.