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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Can't reference a table in my SUBSTITUTE formula...

Hey folks, probably a simple fix but something I'm stuck on:

I'm trying to create a SUBSTITUTE function to replace some text within a string to generate a URL for users to click. Here's my code thus far

 

Measure 1 = 

SUBSTITUTE( 
	SUBSTITUTE(
		SUBSTITUTE(
			SUBSTITUTE( (CP), "(", "")
		,")",""),
	"/",""),
" ","-")

 

The issue I'm having is during the last SUBSTITUTE argument where you see the (CP) listed. CP is one of the sheets in my dataset, however it's not the one I need to reference. I'm trying to reference a different sheet and column, but when I type the sheet/table name in, nothing is found. The only data PBI can find is from the CP sheet. 

If I try a different argument, say SUM, then I can find the sheet/table I'm trying to reference in the SUBSTITUTE argument.

I'm not sure what gives? Why can I see it in some arguments (SUM) but not others (SUBSTITUTE)?

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous,

Acutally, you can create a calculated column on the table you want  to refer so that you refer the fields of that table. But if you insist on using measure to get the results, you can refer to fields in that tables with the help of some functions. For example : FIRSTNONBLANK (suggested by @Anonymous ) , MAX , MIN or other function . Hence , you can update your measure formula as below : 

substitude problem.JPG

Best Regards

Rena

Community Support Team _ Rena
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

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous,

Acutally, you can create a calculated column on the table you want  to refer so that you refer the fields of that table. But if you insist on using measure to get the results, you can refer to fields in that tables with the help of some functions. For example : FIRSTNONBLANK (suggested by @Anonymous ) , MAX , MIN or other function . Hence , you can update your measure formula as below : 

substitude problem.JPG

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @Anonymous 

 

It looks like you have a calculated measure, if you use a calculated column then you will be able to reference the column you want. The calculated column will have to be in the same table. If you have to use a measure, you need to use an expression that will reference the column such as "firstnonblank", etc.

 

- Paul

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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