Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Format value to currency and percent in the same row, and get a numeric output to sort them as numeric, not by alphabet.
My output is a table that I want to sort by the value. The problem is that the value right now is a text.
I leave the formula that I'm using:
Formatted Value = 
VAR Result = 
IF(
    SUM('Main Table'[VALUE]) <> 0,
    SWITCH(
        MAX('Main Table'[PL_ACCOUNT_TYPE_NAME]),
        "Revenue", CONVERT(FORMAT(SUM('Main Table'[VALUE]), "Currency"), CURRENCY),
        "Contribution Margin", FORMAT(SUM('Main Table'[VALUE]), "$#0,0"),
        "Gross Margin", FORMAT(SUM('Main Table'[VALUE]), "$#0,0"),
        "Overhead", FORMAT(SUM('Main Table'[VALUE]), "$#0,0"),
        "Non-Labor Operating Costs", FORMAT(SUM('Main Table'[VALUE]), "$#0,0"),
        "Total Labor Costs", FORMAT(SUM('Main Table'[VALUE]), "$#0,0"),
        "Gross Margin %", FORMAT(FORMAT(SUM('Main Table'[VALUE]), "Percent"), "General Number"),
        (AVERAGE('Main Table'[VALUE])* 100) & "%"
    )
)
Return
Result
@SebastianOliver , I think you should is Dynamic format string for this
https://powerbi.microsoft.com/en-us/blog/deep-dive-into-the-new-dynamic-format-strings-for-measures/
Power BI Dynamic Format Strings for Measures| Format without converting to text: https://youtu.be/qHALucET7N8
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.