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

fiscal week calculations

hello, 

 

i need help in this, 

 

i have a fiscal week calender which starts on wednesday and ends on tuesday so week day =1 on wednesday and weekday= 7 on tuesday. 

 

in my reprot user will select from two slicers :

1- montn (EX. December)

2- Week number (EX. Week2)

 

in this case ,the date will be between (2-12-2020 and 8-12-2020)

 

now the output that i have to calculate is :

 

(total orders for the same selected period LAST MONTH ) which according to the given example output should be within:

 Month :November- Week: Week 2 - date between: (11-11-2020 and 17-11-2020)

 

note that the given dates are just an example to explain how the logic should work so i would like my DAX measure to calulate dynamically the output for any selected Month and week the user will select.

 

 

Appreciate the help..

 

1 REPLY 1
amitchandak
Super User
Super User

@lawada , for Tuesday week, refer

 

.Any Weekday Week - Start From Any day of Week
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...

 

for  month week

 

Start Month = STARTOMONTH('Date'[Date])
WeekDay = WEEKDAY([Date],2) //Use the Tuesday week this is Monday
Start of Week = [Date] -[WeekDay]+1 //Use the Tuesday week this is Monday
Month Week = QUOTIENT(DATEDIFF(Minx(FILTER('Date',[Start Month]=EARLIER([Start Month])),'Date'[Start of Week]),[Date],DAY),7)+1

 

now you can compare week this month vs week last month

 

Otherwise week is 28 days behind

last month same week Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-28,DAY )))

 

 

also check

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

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.

Top Solution Authors