I have a query that targets our resourceGroupName on Azure.
The resourceGroupName looks like this:
hello-world-customer-prod-rg
hello-world-customer-staging-rg
hello-world-customer-test-rg
hello-world-customer-dev-rg
I want to remove the last rg
from each resourceGroupName
For now I tried this:
URL_test1 = Text.Start(SELECTEDVALUE('Usage details'[resourceGroupName]);Text.Lengh('Usage details'[resourceGroupName])-2)
but I receive 'Text.Start' is not a function
and Unexpected expression Text.Length
or this:
URL_test2 = RIGHT(SELECTEDVALUE('Usage details'[resourceGroupName]);2)
and I receive Unexpected expression ;
Nothing really seems to work.
What am I doing wrong?
EDIT: this seems working but it returns me the number of characters (17) and not the text:
URL_test3 = LEN(SUBSTITUTE(SELECTEDVALUE('Usage details'[resourceGroupName]),"-rg",""))
I have actually found the solution.
I passed from:
URL_test3 = LEN(SUBSTITUTE(SELECTEDVALUE('Usage details'[resourceGroupName]),"-rg",""))
to:
URL_test3 = SUBSTITUTE(SELECTEDVALUE('Usage details'[resourceGroupName]),"-rg","")
That's why it was showing the number!
It was because of the LEN()
.