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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
matt8c
Regular Visitor

SAMEPERIODLASTYEAR with a non date slicer

Hi,

 

I have a report that calculates the YoY revenue rate, using direct query mode.

 

The following measures are similar to this:

gbprevenue = CALCULATE(SUM('revenue'[gbp]), 'revenue'[type] <> "Lost")

sameperiodlastyeargbprevenue = CALCULATE('revenue'[gbprevenue], SAMEPERIODLASTYEAR('revenue'[date]))
 
The report also has a slicer to filter on products (e.g. All, Product 1, Product 2)
When the slicer has no selection (All value), both the measures return the correct result.
However, if a product is selected in the slicer (e.g. Product 1), the gbprevenue measure is calculated correctly but the the same period measure still returns the value for all products.
 
Any tips on where I'm going wrong here would be hugely appreciated.
Many thanks

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Most of the time intelligence function works best with the continuous date. Create a date table using the calendar function of Powerbi.

https://docs.microsoft.com/en-us/dax/calendar-function-dax

https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions

Join that with you date nad then try.

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

 

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

Most of the time intelligence function works best with the continuous date. Create a date table using the calendar function of Powerbi.

https://docs.microsoft.com/en-us/dax/calendar-function-dax

https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions

Join that with you date nad then try.

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

 

 

Sorry for the late response.

 

Using a calendar function with a relationship fixed the issue.

Thanks

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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