Forum Discussion
sns1996
1 year agoHelper I
Coluna semana
Pessoal, Estou precisando criar uma coluna na minha tabela calendário (Criada em DAX) uma coluna com a semana do mês (1º Semana, 2º Semana, etc) A semana começa na segunda-feira e termina do doming...
- Anonymous1 year ago
Hi,
Thanks for the solution lbendlin offered, and i want to offer some more information for user to refer to.
hello sns1996 , you can refer to the following sample.
Sample calendar table.
Table = ADDCOLUMNS(CALENDAR(DATE(2023,1,1),DATE(2024,12,31)),"Weekday",WEEKDAY([Date],2))Add a calculated column.
Mon_Week = VAR a = COUNTROWS ( FILTER ( 'Table', EOMONTH ( [Date], 0 ) = EOMONTH ( EARLIER ( 'Table'[Date] ), 0 ) && [Date] < EARLIER ( 'Table'[Date] ) && [Weekday] = 7 ) ) RETURN YEAR ( [Date] ) & "-" & FORMAT ( [Date], "MMM" ) & "W" & a + 1Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
1 year agoNot applicable
Hi,
Thanks for the solution lbendlin offered, and i want to offer some more information for user to refer to.
hello sns1996 , you can refer to the following sample.
Sample calendar table.
Table = ADDCOLUMNS(CALENDAR(DATE(2023,1,1),DATE(2024,12,31)),"Weekday",WEEKDAY([Date],2))
Add a calculated column.
Mon_Week =
VAR a =
COUNTROWS (
FILTER (
'Table',
EOMONTH ( [Date], 0 ) = EOMONTH ( EARLIER ( 'Table'[Date] ), 0 )
&& [Date] < EARLIER ( 'Table'[Date] )
&& [Weekday] = 7
)
)
RETURN
YEAR ( [Date] ) & "-"
& FORMAT ( [Date], "MMM" ) & "W" & a + 1
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.