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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
kasife
Helper V
Helper V

Week per month

Hi guys.

 

I'm trying to create a calculated column that gives me the week of the month according to the calendar of the year. As shown in the image below, we can see that the 1st week of August starts on the 1st and ends on the 6th.

kasife_1-1696291604272.png

I am using the following measure, but it is not working

SemanaDoMes = 
VAR DataAtual = [Date]
VAR PrimeiroDiaDoMes = DATE(YEAR(DataAtual), MONTH(DataAtual), 1)
VAR DiaDaData = DAY(DataAtual)
VAR DiaDaSemana = WEEKDAY(PrimeiroDiaDoMes)
VAR DiasNoPrimeiraSemana = 7 - DiaDaSemana + 1
VAR Semana = INT((DiaDaData - DiasNoPrimeiraSemana) / 7) + 1
RETURN
 IF(DiaDaData <= DiasNoPrimeiraSemana, "1ª Semana", Semana & "ª Semana")

This is the result it is returning to me

kasife_2-1696291760383.png

How could I adjust this measurement?

 

1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

Simple enough,

ThxAlot_0-1696298227423.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



View solution in original post

2 REPLIES 2
ThxAlot
Super User
Super User

Simple enough,

ThxAlot_0-1696298227423.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



@ThxAlot This worked perfectly. Thanks

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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