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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Chandrashekar
Resolver III
Resolver III

WeekNum vs Month

Hello,

am looking for column formula. If week number continuous to next month I need to get previous month.

 

Link: Sample file 

 

Regards,

Chandrashekar B

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Chandrashekar 

 

I added the comment:

Column = 

VAR _A = CALCULATE (
        MIN ( 'Table'[Month] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Week] = EARLIER ( 'Table'[Week] ) )
    )
    //Get the min date of every week, for examnple, the 16th week is 2024-04-15
RETURN FORMAT(_A,"MMM-YY")
//format the column to "MMM-YY"

 The outcome of variable _A:

vzhengdxumsft_0-1715752171038.png

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
aduguid
Memorable Member
Memorable Member

Can you post an example of what you expect to see?

Hello,

 

Expected result is in sample pbix file(already shared). am looking for column formula(new column) If week number continuous to next month I need to get previous month.

Link: Sample file 

Chandrashekar_1-1715665672510.png

 

Regards,

Chandrashekar B

 

Anonymous
Not applicable

Hi @Chandrashekar 

 

Your files are set with access permissions, and I'm requesting access.

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

 

Please check below link.

 

Sample File: Sample File 

 

Regards,

Chandrashekar B

Anonymous
Not applicable

Hi @Chandrashekar 

 

Please try this:

Create a calculated column:

Column =
FORMAT (
    CALCULATE (
        MIN ( 'Table'[Month] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Week] = EARLIER ( 'Table'[Week] ) )
    ),
    "MMM-YY"
)

The result is as follow:

vzhengdxumsft_0-1715750746187.png

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you it is working perfectly. Can you please explain how it works in steps please.

 

Regards,

Chandrashekar B

Anonymous
Not applicable

Hi @Chandrashekar 

 

I added the comment:

Column = 

VAR _A = CALCULATE (
        MIN ( 'Table'[Month] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Week] = EARLIER ( 'Table'[Week] ) )
    )
    //Get the min date of every week, for examnple, the 16th week is 2024-04-15
RETURN FORMAT(_A,"MMM-YY")
//format the column to "MMM-YY"

 The outcome of variable _A:

vzhengdxumsft_0-1715752171038.png

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.