Forum Discussion
DAX function for converting a number into a string?
I have a string (url) and a number (pagination), I need to concatenate them into a resulting URL.
I have search and looked at the VALUE and FORMAT dax functions but can't make it work in converting a number into a string. e.g.
"http://www.xyz.com?page=" & [page]
returns an error "We cannot apply operator & to text and number.
Any clues how I can convert [page] to a string?
- Anonymous10 years ago
Thanks, ended up using Text.From( [Counter] )
12 Replies
- AnonymousNot applicable
Anonymous
try using
"http://www.xyz.com?page=" & Format([page] ,"####")
If this works please accept as a solution and also give Kudos. If it does not work let me know what happened.
Cheers
- AnonymousNot applicable
Yes, this is easy to pull off in Power Query. If you need to do this in the model (for instance, off of a calculated table), the correct DAX would be to use FIXED(<number>,3,1) to convert the number into string at 3 decimals and then RIGHT(<>,3) to retun the right 3 decimals.
- v-haibl-msftMicrosoft Employee
Anonymous
You can also do the concatenation by “Merge Columns” in Query Editor. Select these two columns and click “Merge Columns”.
Best Regards,
Herbert
- rafaeloureirosmAdvocate I
= "Text" & Number.ToText(Number)
- joopiestFrequent Visitor
Wow, That's pretty easy.
Thanks
- omikeyzHelper I
All I did was to create a new column
1 Material_T = Materials[Material]and I formatted that field as a text. Then I can use the search Text in my visuals rather than using a filter for 50,000 numbers. it works fine. - GlennHGRegular Visitor
It is quiet unfortunate that, still a lot of responders could not differentiate between DAX and Power Query M. 😞