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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
jeongkim
Post Prodigy
Post Prodigy

Get particular text from the cell with M code

Hi,

 

I would like to get only week number e.g. '11' from Source name. 

Please help for M code.

 

 

jeongkim_0-1724649307707.png

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @jeongkim - you can achieve this in two ways in M code add a new custom column as bleow

Text.Middle([Source Name],1,2)

 

rajendraongole1_0-1724654468582.png

 

Method2: Text.BetweenDelimiters([Source Name], "W", "_")

column from example with selection of source name column , you can give suggestion of 1 example to the query engine , you can achieve the output as expected.

rajendraongole1_1-1724654604965.png

 

 

 

Hope it works

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
rajendraongole1
Super User
Super User

Hi @jeongkim - you can achieve this in two ways in M code add a new custom column as bleow

Text.Middle([Source Name],1,2)

 

rajendraongole1_0-1724654468582.png

 

Method2: Text.BetweenDelimiters([Source Name], "W", "_")

column from example with selection of source name column , you can give suggestion of 1 example to the query engine , you can achieve the output as expected.

rajendraongole1_1-1724654604965.png

 

 

 

Hope it works

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thanks it works, accepted.

Another question pls, can we add Minus function with today's week number?

e.g. 30(from W30 xxxxxx(source.name)) - 35(from today's week) which result will be -5

 

I wanna get data only in the last 26 weeks(half year) but the numbers from custom column you helped doens't have filter for this function, it seems only date filter is available. 

 

So I wanna make calculation to filter if it is below than -26 than unfilter. 

 

jeongkim_0-1724770048088.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors