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
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
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.