Forum Discussion

YagoXavier's avatar
YagoXavier
Icon for Helper I rankHelper I
1 year ago
Solved

Help with formatting measure(Swicth) with conditional based on selected parameter in power bi

Hello everyone, good afternoon. I need help with my data analysis project in Power BI. Objective: Format the measure inserted in the 2 graphs that I use to compare the selected parameters. Context...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi YagoXavier 

    Thank you for using Microsoft Community Forum.

     

    The issue you're experiencing is due to how the FORMAT() function works in DAX. While FORMAT() can apply specific numeric formats like currency or decimal places, it converts the result into a text data type. This means visuals like bar and column charts, which require numeric values for rendering and aggregations (e.g., tooltips, data labels), cannot interpret the formatted output correctly, leading to visuals disappearing or behaving unexpectedly.

     To dynamically apply formatting based on the selected comparison parameter without converting your measure to text, we recommend using Calculation Groups via Tabular Editor. Calculation Groups allow you to define both the expression and the numeric format string separately, preserving the numeric data type while enabling the desired formatting (such as currency, whole number, or decimal) depending on the user’s slicer selection. This approach resolves the formatting limitation cleanly and is the officially supported method for dynamic formatting in Power BI.

     

    If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
    Thank you.