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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
luvnet18
New Member

DAX Command for getting Avg (%) of the previous 2 weeks

Want to show a single column of (B) Implied Closing Rate by weekly trend when it's latest 2 weeks (WkFlag=0 and -1) then show (B) Implied Close Rate, otherwise show (A) Closing Rate

(A) Closing Rate = Booked/Quoted
(B) Implied Closing Rate = Only happen on last 2 Weeks.   Calculation = Closing Rate Average of the Previous 2 Weeks

Sample Implied Calculation :-

Wk5 (WkFlag -1) =AVERAGE(18.52%,19.39%)=18.96%
Wk6 (WkFlag 0) =AVERAGE(19.39%,18.96%)=19.17%


ImpliedConv.JPG

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@luvnet18 , In your date or week table can you create a rank column

 

Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

 

Then you can deal with a week like

 

This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))
Last 2 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-2 && 'Date'[Week Rank]<=max('Date'[Week Rank])))

 

Also check my detailed blog on this

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I already have a field WkFlag=0 Last Week and WkFlag=-1 as the 2nd last week.

However, I need a formula to Calculate Implied Closing Rate for WkFlag=0 and WkFlag=-1 using Average Closing Rate of the previous 2 weeks 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.