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
tracytran91
Helper III
Helper III

% Growth Last N days/weeks/Months/Year regarding Relative Date Slicer

 

Hi friends, 

 

I would like to caculate the % Growth Last N days/weeks/Months/Year regarding the relative Date Slicer. 

 

For example:

- If the user selects last 1 week (calendar) from 14 feb to 20 Feb 2021

=> % growth = ((Sale from 14 feb to 20 Feb 2021) - (Sale from 7 feb to 13 Feb 2021) )/  (Sale from 7 feb to 13 Feb 2021)

 

- If the user selects last 1 week from 20 feb to 26 Feb 2021

=> % growth = ((Sale from 20 feb to 26 Feb 2021) - (Sale from 13 feb to 19 Feb 2021) )/  (Sale from 13 feb to 19 Feb 2021)

 

RelativeDate.png

 

Any help is highly appreciated. 

Thank you in advance. 

 

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @tracytran91  ,

According to your description, I create this data:

v-yangliu-msft_0-1614645583464.png

Here are the steps you can follow:

1. Create calculated table.

Week = WEEKNUM('Table'[date])

2. Create measure.

Measure =
var _min=
MIN('Table'[date])
var _max=MAX('Table'[date])
var _sum1=CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[date]>=_min&&'Table'[date]<=_max))
var _sum2=CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[Week]=MAX('Table'[Week])-1))
return
DIVIDE(_sum1,_sum2)

3. Result.

v-yangliu-msft_1-1614645583470.png

 

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

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

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @tracytran91  ,

According to your description, I create this data:

v-yangliu-msft_0-1614645583464.png

Here are the steps you can follow:

1. Create calculated table.

Week = WEEKNUM('Table'[date])

2. Create measure.

Measure =
var _min=
MIN('Table'[date])
var _max=MAX('Table'[date])
var _sum1=CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[date]>=_min&&'Table'[date]<=_max))
var _sum2=CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[Week]=MAX('Table'[Week])-1))
return
DIVIDE(_sum1,_sum2)

3. Result.

v-yangliu-msft_1-1614645583470.png

 

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

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

amitchandak
Super User
Super User

@tracytran91 , You need to create a few measures to that.  They can use time intelligence and date table. Refer blog

You can also use trailing measures

Last Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))

Week behind  = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-7))

 

Month behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Month))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

 

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...

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.