Forum Discussion

Rita_Vaz's avatar
Rita_Vaz
Frequent Visitor
1 year ago

Dynamic Formatting not working properly

Hello everyone, 

 

I am having some issues with the dynamic formatting of a measure. I am using this simple code in the format: 

 

SWITCH (
    TRUE (),
    SELECTEDMEASURE () >= 0 && SELECTEDMEASURE () < 1000,FORMAT ( SELECTEDMEASURE (),  "#0 " ),
    SELECTEDMEASURE () >= 1000 && SELECTEDMEASURE () < 1000000, FORMAT ( SELECTEDMEASURE (),  " #,##0,.0 k" ),
    SELECTEDMEASURE () >= 1000000 &&  SELECTEDMEASURE () < 1000000000,FORMAT ( SELECTEDMEASURE (),"#,##0,,.0 M" ),
    SELECTEDMEASURE () >= 1000000000,FORMAT ( SELECTEDMEASURE (), "#,##0,,,.0 bn")
)

 

I am using this measure in a bar chart with a category in the y-axis and for some categories the data label is misformatted, see image bellow:

 

 

Has anyone had the same issue? 

 

Thank you

 

4 Replies

  • BeaBF's avatar
    BeaBF
    Super User

    Rita_Vaz Try with:

    SWITCH (
    TRUE (),
    SELECTEDMEASURE () >= 0 && SELECTEDMEASURE () < 1000, FORMAT ( SELECTEDMEASURE (), "#0" ),
    SELECTEDMEASURE () >= 1000 && SELECTEDMEASURE () < 1000000, FORMAT ( SELECTEDMEASURE (), "#,##0,.0 K" ),
    SELECTEDMEASURE () >= 1000000 && SELECTEDMEASURE () < 1000000000, FORMAT ( SELECTEDMEASURE (), "#,##0,,.0 M" ),
    SELECTEDMEASURE () >= 1000000000 && SELECTEDMEASURE () < 1000000000000, FORMAT ( SELECTEDMEASURE (), "#,##0,,,.0 Bn" ),
    SELECTEDMEASURE () >= 1000000000000, FORMAT ( SELECTEDMEASURE (), "#,##0,,,.0 Tn" )
    )

    BBF

    • Rita_Vaz's avatar
      Rita_Vaz
      Frequent Visitor

      Hello, 

       

      Thank you for your fast response!

      I tried the code you sent but the issue still remains 😞 

       

       

      • BeaBF's avatar
        BeaBF
        Super User

        Rita_Vaz can you share the pbix file or the sample data under the visual?