Forum Discussion
Replicate Google Data Studio ISO week in Power BI
Hey Super Users! I'm trying to replicate Google Data Studio's ISO week on Power BI. When I get the data from Google Analytics, the ISO week displays as a number whereas what I need is a week format. Any idea if that is possible? I've added reference screenshots for more info. Thanks so much for all your help.
6 Replies
- Greg_Deckler
Community Champion
shrutiiyer - You can use Week Starting/Ending to format your week however you want
https://community.powerbi.com/t5/Quick-Measures-Gallery/Week-Starting/m-p/391487#M123
I think that 21 is the WEEKNUM parameter for ISO.
- amitchandak
Super User
shrutiiyer , your are getting week like , you can get date
Week to Date = var _st = date(left([Week],4),1,1)
var _week = right([Week],2)*1
Return _st+((_week-1)*7) -WEEKDAY(_st,2)+1Or //Sunday week
Week to Date = var _st = date(left([Week],4),1,1)
var _week = right([Week],2)*1
Return _st+((_week-1)*7) -WEEKDAY(_st,1)+1Now create a date table and have all those field there
Date = CALENDAR(date(2015,03,01),Date(2021,02,28)) //calendar
Week Start date = 'Date'[Date] + -1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date] + 7 –1*WEEKDAY('Date'[Date],2)
Week Number = WEEKNUM([Date],2)
Week = if('Date'[Week Number]<10,'Date'[Year]*10 & 'Date'[Week Number],'Date'[Year]&'Date'[Week Number])
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
Week name = [Week Start date] & " to "& [Week End date]
Weekday = WEEKDAY([Date],2)
WeekDay Name = FORMAT([Date],"ddd")
Year = YEAR('Date'[Date])Refer : https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
You can use format to change display week Name above.
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos. - amitchandak
Super User
shrutiiyer , You can cover your week number to date
Week to Date = var _st = date(left([Week],4),1,1)
var _week = right([Week],2)*1
Return _st+((_week-1)*7) -WEEKDAY(_st,2)+1//Sunday week
Week to Date = var _st = date(left([Week],4),1,1)
var _week = right([Week],2)*1
Return _st+((_week-1)*7) -WEEKDAY(_st,1)+1Create a date calendar with all these
Date = CALENDAR(date(2015,03,01),Date(2021,02,28)) //calendar Week Start date = 'Date'[Date] + -1*WEEKDAY('Date'[Date],2)+1 Week End date = 'Date'[Date] + 7 –1*WEEKDAY('Date'[Date],2) Week Number = WEEKNUM([Date],2) Week = if('Date'[Week Number]<10,'Date'[Year]*10 & 'Date'[Week Number],'Date'[Year]&'Date'[Week Number]) Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense) Week name = [Week Start date] & " to "& [Week End date] Weekday = WEEKDAY([Date],2) WeekDay Name = FORMAT([Date],"ddd") Year = YEAR('Date'[Date])refer
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos. - v-kelly-msft
Community Support
Hi shrutiiyer ,
Is your issue solved now?
Best Regards,
KellyDid I answer your question? Mark my post as a solution!- shrutiiyer
Helper I
Hey there! No I'm yet to try all of the solutions shared by the commmunity 🙂
- v-kelly-msft
Community Support
Hi shrutiiyer ,
How about adding a new column in power bi ?Such as below:
Column=[date]&"weeknum"&WEEKNUM([date])Best Regards,
KellyDid I answer your question? Mark my post as a solution!