Dax Function: UNICHAR
Category: Text Functions
The UNICHAR function in Power BI is a DAX (Data Analysis Expressions) function that returns the Unicode character corresponding to a specified numeric value. Unicode is a standardized encoding system used for text representation across different platforms and languages.
Purpose
Text Representation: Generate special characters, symbols, or emojis in text fields or visuals.
Data Enrichment: Add icons, arrows, or symbols for enhanced data visualization.
Unicode Encoding: Retrieve specific Unicode characters based on their numeric codes.
Type of Calculations
The function performs a simple scalar transformation by mapping numeric values to their Unicode character equivalents.
Practical Use Cases
Icons in Tables or Cards: Display visual indicators like checkmarks, arrows, or emojis.
Custom Labels: Add symbols to text labels for better interpretation.
Dynamic Visuals: Create calculated columns or measures with symbols for data categorization or conditional formatting.
Localization Support: Insert characters from non-Latin scripts like Arabic, Chinese, or Cyrillic.
UNICHAR(<number>)</number>
| Parameter | Type | Description |
|---|---|---|
| number | Numeric/Scalar | A positive integer that represents a Unicode character. |
How Does UNICHAR Dax Function Works
Numeric Input: The function takes a positive integer representing a Unicode code point.
Mapping to Character: Maps this code point to its corresponding character in the Unicode table.
Output: Returns the Unicode character.
For example:
Input:
128512(Unicode for 😀)Output:
😀
What Does It Return?
The function returns a single Unicode character as a text string corresponding to the input number.
When Should We Use It?
Add Visual Indicators: Use symbols or emojis in reports to improve readability and engagement.
Localization Needs: Render characters from diverse languages.
Dynamic Icons: Generate custom visuals based on data conditions.
Examples
Basic Usage :
UNICHAR(10004)
Result: ✔ (Checkmark)
Column Usage:
Add a status indicator in a calculated column:
StatusSymbol = IF(Table[Status] = "Complete", UNICHAR(10004), UNICHAR(10060))
Input:
"Complete","Pending"Output:
✔for Complete,✖for Pending.
Dynamic Measure:
Display performance with emojis:
Performance =
IF(SUM(Sales[Amount]) > 100000, UNICHAR(128077), UNICHAR(128078))
Output: 👍 for high performance, 👎 for low performance.
Combine with Text:
LabelWithSymbol = "Profit " & UNICHAR(9650)
Output: "Profit ▲"
Tips and Tricks
Unicode Reference: Use a Unicode table (available online) to find the numeric values for desired characters.
Conditional Formatting: Pair UNICHAR with IF or SWITCH to apply different symbols dynamically.
Character Limitations: Ensure the Unicode value corresponds to a valid character; invalid values may result in errors.
Combine with CONCATENATE: Append Unicode characters to text labels for enriched outputs.
Performance Impact of UNICHAR DAX Function:
Minimal Impact: The function has negligible performance overhead since it operates on scalar values.
Pre-Filter Data: When used in large datasets, pre-filtering data reduces unnecessary calculations.
Related Functions You Might Need
CHAR: Returns a character based on the ASCII code (alternative for smaller character sets).
CONCATENATE: Combine multiple text strings or symbols.
SWITCH: Apply multiple conditions for dynamic symbol generation.
Want to Learn More?
For more information, check out the official Microsoft documentation for UNICHAR You can also experiment with this function in your Power BI reports to explore its capabilities.
Unlock the full capabilities of Power BI and elevate your data insights with our specialized consulting services. Whether you need guidance on advanced DAX functions like those highlighted here, support in designing interactive dashboards, or expertise in optimizing data models for enhanced performance, our experienced Power BI consultants are equipped to deliver customized solutions for your business. Explore our Power BI Consulting Services page to discover how we can help your organization make smarter, data-driven decisions.
It returns the Unicode character corresponding to a given numeric code.
Yes, by providing the Unicode value of the desired emoji.
The function returns an error if the Unicode value does not map to a valid character.
Yes, it is commonly used for icons, arrows, or symbols in conditional formatting.
UNICHAR supports a broader Unicode range, while CHAR is limited to ASCII values.