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
Anonymous
Not applicable

Previous Year Measure completely wrong

Hi All - I am pulling my hair out with overcoming this basic requirement that other BI tools have handled so well.

 

The requirement is that users can interact with an embedded date slicer and control which date range to display a measure for. In this case it would be 'Sales'. There is also a requirement to shows last year sales for the same date range -1 year.

 

So I set it up my measure being 

Booked Sales = SUM(vw_fact_booking[net_total_amt])

and my date slicer works fine:

measure with date slicer works

So now to do 'Year ago' - easy enough:
Booked Sales YAGO = CALCULATE(SUM(vw_fact_booking[net_total_amt]),PREVIOUSYEAR(vw_fact_booking[booking_date]))


Nope! You can see that the sales for previous year are more like this:

 

 

What am I doing wrong?

 

 

 

 

 

2 ACCEPTED SOLUTIONS

Figured it out!

 

Took me a while to download the 800MB model over my phone 😮

 

The correct DAX formula should be

 

Booked Sales YAGO = CALCULATE(SUM(vw_fact_booking[net_total_amt]),SAMEPERIODLASTYEAR(dates[date]))

 

The PREVIOUSYEAR calc was taking the whole previous year into account even if you were only selecting a month from the current year.  Useful for somethings, but not for you.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Anonymous
Not applicable

Thank you @Phil_Seamark

Something so simple turning my hairs grey.

Appreciate your help mate,

Jake

View solution in original post

10 REPLIES 10

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.