- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
DAX function for converting a number into a string?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-17-2016 08:10 PM
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?
Solved! Go to Solution.
Accepted Solutions
Re: DAX function for converting a number into a string?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-18-2016 04:26 PM
All Replies
Re: DAX function for converting a number into a string?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-17-2016 09:17 PM
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
Re: DAX function for converting a number into a string?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-18-2016 04:26 PM
Thanks, ended up using Text.From( [Counter] )
Re: DAX function for converting a number into a string?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-18-2016 07:50 PM
You can also do the concatenation by “Merge Columns” in Query Editor. Select these two columns and click “Merge Columns”.
Best Regards,
Herbert
Re: DAX function for converting a number into a string?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-06-2016 05:11 AM
= "Text" & Number.ToText(Number)
Re: DAX function for converting a number into a string?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-10-2018 05:57 PM
Format() is the correct answer. What you've used is not DAX
Re: DAX function for converting a number into a string?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-15-2018 07:07 AM
HOw to you use this FORMAT() function in example?
lets say if you have two columns where you are appling into a meaure
ie
newmeasure = viewname[columnnameingar] and viewname[newcolumnstring] , "a stringvalue"
Re: DAX function for converting a number into a string?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-06-2019 01:55 PM
Not sure I'm fully understanding you @atrinhatra
General info page on FORMAT: https://docs.microsoft.com/en-us/dax/format-function-dax
Couple examples from: https://docs.microsoft.com/en-us/dax/pre-defined-numeric-formats-for-the-format-function
FORMAT( 12345.67, "General Number")
FORMAT( 12345.67, "Currency")
FORMAT( 12345.67, "Percent")
Combining column values in a measure usually won't work due to context. Unless you first aggregate the columns in some way. Measures yield a single value given a context, so if your context includes multiple rows, then any measure that combines column values without aggregation will error out.
Hope that helps.