How to convert a value into a string with DAX

Hey guys,

I need to concatenate a string and a number into a URL. I tried using the VALUE and FORMAT DAX functions and came up with this:

http://www.xyz.com?page=” & [page]

But it prompts an error saying, “We cannot apply operator & to text and number.”
Any idea how I can make this work?

Thanks in advance!

Where do you get these strings from? If they are on the same row but different columns, you can use the concatenate DAX function. Do you have a data sample?

Hi,
You need to convert the page number into a text and concatenate it with the rest of the expression .
The original expresion = “http://www.xyz.com?page=1" is all text.
Convert the number [page] into text with the expression “http://www.xyz.com?page=” & Number.ToText(page)&”
Don’t forget to add &" after the Number.ToText(page) so that it totally computes as per the original
expression.
eg with the expression above, for page = x, this is what would happen
http://www.xyz.com?page=” & Number.ToText(x)&”
will return “http://www.xyz.com?page=x" which is the similar to the original expression.
This could help you figure it out.
Richard_D
Revision 1
PS On second thoughts, I could be mistaken since the topic refers to DAX and my solution applies to MCode.

You could try something like this:

http://www.xyz.com?page=” & Format([page] ,"####")

Or you could just use Text.From( [Counter] ).

Let me know if either own of them doesn’t work. Maybe we can think of another solution.