cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Anonymous
Not applicable

SamePeriodLastYear with a twist

Hoping the experts here can help me with this situation.

 

I have a detail dataset where each row represents a executed function:

  • Each record has a start date and end date
  • each recor as a "category" that I'm running the metrics for

My initial goal was to show the YOY % change between turn times. I successfully did this by creating (7) measures to handle it:

  1. SUM of the turn times
  2. Count of the turn times
  3. Sum of the turn times using SAMERPERIODLASTYEAR
  4. Count of turn times using SAMERPERIODLASTYEAR
  5. AVG TT using the sum/count in 1 and 2
  6. AVG TT using the sum/count in 3 & 4
  7. % change calculation of 5 and 6

I was successful:

CalculationExample_1.png

 

I have a year over year view of turn times and the % change. However, what I want to do as an extension doesn't seem to really work here and I'm not sure if there's a better expression or approach to this.

 

I want to calculate the % change across years. EX - I want to isolate 2019 and 2022 to show the % change between those years. So 76.35 vs 22.75. When I filter to those years though, through a slicer, it still reains the same %'s (since the data is still there). 

 

CalculationExample_2.png

When I filter the dataset from the filter window to ONLY 2019 and 2022 then the DAX expression breaks.

 

Is there a DAX expression that calculates year to year volume based on the years present and/or staggered INSTEAD of the sameperiodlastyear which is looking for the exact previous year?

 

Thanks all in advance for your help.

1 REPLY 1
speedramps
Community Champion
Community Champion

Only Power BI novices use SamePeriodLastYear and other DAX inbult date function.

 

If you want to become Power BI the start using cvalendar tables for ALL date functions.

Click here to start learning about calendar tables 

Then click here to learn about calendar offsets 

 

Thanks for reaching out for help.

I put in a lot of effort to help you, now please quickly help me by giving kudos.

Remeber we are unpaid volunteers and here to coach you with Power BI and DAX skills and techniques, not do the users job for them. So please click the thumbs up and accept as solution button. 

If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime.  I prefer to teach members on this forum techniques rather give full solutions and do their job. You can then adapt the technique for your solution, learn some DAX skills for next time and soon become a Power BI Super User like me. 

 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors