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.
Hi everyone,
I'm facing these challenges that
1. i want to count week in a year (from 1 to 52). Weeknum function only gives me 2 options for either monday or sunday as starting day. But i need saturday as my starting day. I hope there is a way to work around this.
2. I also need to distingguish week number between years. for example both 2016 and 2017 have week number 10. when i create a year slicer, it works fine if i choose only one of the year (2016 and 2017) but if i choose both, power bi combines both week 10 of 2016 and 2017 while what i wanna see is the difference/development between the 2
Thanks
Solved! Go to Solution.
@GiangLe Your formula will give wrong results (week number 1 too high) for Saturdays in years where January 1 is on Saturday (e.g. 2022).
My suggestion would be:
Weekno = If( weekday ([date], 1) < 7 || weekday(date(year([date]),1,1)) = 7, weeknum([date], 1 ), weeknum([date], 1) +1 )
Hi everyone, i found a way to work around problem 1 with IF function, it goes like this in case someone will need it in the future
Weekno =
If( weekday (date, 1) < 7,
weeknum(date ,1 ),
weeknum(date, 1) +1
)
Hi @GiangLe,
I am gald to hear you have resolved your issue by yourself. Please mark the right/helpful reply as answer. More people will learn new things here.
Thanks,
Angelia
@GiangLe Your formula will give wrong results (week number 1 too high) for Saturdays in years where January 1 is on Saturday (e.g. 2022).
My suggestion would be:
Weekno = If( weekday ([date], 1) < 7 || weekday(date(year([date]),1,1)) = 7, weeknum([date], 1 ), weeknum([date], 1) +1 )
This worked worked wonders for me. I was trying to do it for Friday so changed it to 6 and it worked.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |