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
DonalMc
Advocate II
Advocate II

Compare User Selected Date Periods

I have been asked to provide the ability to compare data from two user selected date periods.

For eaxmpler, Google Analytics has a nice feature whereby a user can select  two date periods and compare them (see image below).

When this is enabled, the data for second date period is overlayed on the initially displayed one.

Has anyone every achieved anything like this in PBI?

I'm guessing probably not!

 

Am I correct in my belief that comparing custom or user selected date periods is something that Power BI is not very strong in?

Right now, I think my best option is to add a date slicer and have the user open the report page in two windows.

 

Thanks,

Donal

 

date-overlay.png

 

 

3 REPLIES 3
v-jiascu-msft
Employee
Employee

@DonalMc,

 

Hi Donal,

 

This could be easy with DAX formula. Please have a look at the example. 

1. It compares totals of quantity between January 2007 and February 2007;

2. The formula is:

QuantityInLastMonth =
CALCULATE ( SUM ( 'Sales'[Quantity] ), DATEADD ( 'Date'[Date], -1, MONTH ) )

3. This formula compares the same day between different months. One note: due to the end day of each month are different, the bigger day will inherit the smaller day. For instance, the date of last month for 5.31 would be 4.30. 

4. If you can provide more details, we can find a solution. The details could be how to handle the compare between 5.31 with last month. 

Compare User Selected Date Periods.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

Hi Dale,

 

Thanks for the response. It is a nice suggestion for comaring the previous month and if this suits some they should also look at SAMEPERIODLASTYEAR.

 

I am looking for something a little more dynamic re selecting the date periods, for example, a manager might want to compare February of this year with March of last year (there could be sound reasons for wanting this!).

 

Tbh, I think this would require a new type of page in PBI.

 

Thanks,

Donal

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.