DAX CHAPTER 9: Text Functions

DAX function for text processing, and other languages ​​are very similar.

First, the text connection

Text Links can also be implemented using & operator may be used to implement functions CONCATENATE:

CONCATENATE(<text1>, <text2>) 

Throughout all the rows in the table, using a string delimiter splice, the return value is a string not used:

CONCATENATEX(<table>, <expression>, [delimiter]) 

According separator, connected to a plurality of string, returns a string:

COMBINEVALUES(<delimiter>, <expression>, <expression>[, <expression>]…)

For example, each row of the table DimDate, and the field MonthName CalendarYear to the separator "," together:

DISTINCT(SELECTCOLUMNS(DimDate, "Month", COMBINEVALUES(",", [MonthName], [CalendarYear])))

Second, the text comparison

Compare the two texts are the same, returns True or False

EXACT(<text1>,<text2>)  

Third, the text search

FIND function is case-sensitive, for finding find_text from within_text, if the text is present, it returns the first matching string of the first character position; if not found, then the return value NotFoundValue specified, or BLANK () .

FIND(<find_text>, <within_text>[, [<start_num>][, <NotFoundValue>]])  

FIND function does not support wildcards, SEARCH function supports wildcards to find, but SEARCH is not case sensitive, but the accent.

SEARCH(<find_text>, <within_text>[, [<start_num>][, <NotFoundValue>]]) 

Fourth, formatted text

FIXED for rounding to the specified number of decimal places, and returns the result into text, if no_commas set to 1, in results not explicitly comma; If set to 0, or ignored, in results explicit comma.

FIXED(<number>, <decimals>, <no_commas>)  

FORMAT function for formatting text, numeric and date types for the explicit text specific format:

FORMAT(<value>, <format_string>)

V. interception substring

Taken substring from the start position and the end position specified text

LEFT(<text>, <num_chars>)
RIGHT(<text>, <num_chars>)  
MID(<text>, <start_num>, <num_chars>) 

Sixth, the replacement string

Old_text from the beginning of start_num num_chars characters replaced new_text

REPLACE(<old_text>, <start_num>, <num_chars>, <new_text>)  

Seven other string functions

  • LOWER (<text>): lowercase
  • UPPER (<text>): Conversion uppercase
  • TRIM (<text>): removing spaces across the text
  • REPT (<text>, <num_times>): the text times repeated NUM_TIMES
  • CODE (text): The first character conversion bit ASCII encoding text
  • UNICHAR (number): the digital conversion to Unicode
  • LEN (<text>): length of the text
  • VALUE (<text>): the digital conversion of bit value type text

 

Reference documents:

Text functions

Guess you like

Origin www.cnblogs.com/ljhdo/p/10420858.html