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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors