Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
RFraess
Regular Visitor

Issue with formatting numbers in cards

I am trying to use the following format string expression to format numbers in cards and donut charts, and I am having issues with any numbers >=100k and <1M. The formatting works in a table or a multi-row card, but not in a card or a donut chart.

Format String Expression:

SWITCH ( TRUE (), SELECTEDMEASURE() < 100000, "$#0,.0K", SELECTEDMEASURE() >= 100000 && SELECTEDMEASURE() < 1000000 , "$#,.K", SELECTEDMEASURE() >= 1000000 && SELECTEDMEASURE() < 10000000 , "$#,##,,.00M", SELECTEDMEASURE() >= 10000000 , "$#,##,,.0M", "")


Here are the measures in cards with formatting off:

RFraess_0-1669740018043.png

Here are the measures in cards with the formatting on:

The bottom label is how I would like to numbers to be formatted.

RFraess_1-1669740059456.png

 

Here is a table with the formatting off:

RFraess_3-1669740163021.png

And here is a table with the formatting on:

RFraess_4-1669740193065.png

The formatting in the table is successful, but the formatting in the card is not.

If I change the card to a multi-row card the formatting works:

RFraess_5-1669740280604.png

The same problem happens in a donut chart. Here is the unformatted donut chart:

RFraess_7-1669740398050.png

 

And here is the formatted donut chart:

RFraess_8-1669740418206.png

 

Thanks in advance for any insight.

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @RFraess ,

Pls test the below:

Value( Format (Sales[sales_values],"$#,##0;($#,##0)"))

 


custom format for showing $:

https://msdn.microsoft.com/en-us/library/ee634206.aspx 

 

A similar case refer:

https://community.powerbi.com/t5/Desktop/Format-function-destroys-some-of-charts/m-p/106221 

 

 

 

Best Regards

Lucien

View solution in original post

1 REPLY 1
v-luwang-msft
Community Support
Community Support

Hi @RFraess ,

Pls test the below:

Value( Format (Sales[sales_values],"$#,##0;($#,##0)"))

 


custom format for showing $:

https://msdn.microsoft.com/en-us/library/ee634206.aspx 

 

A similar case refer:

https://community.powerbi.com/t5/Desktop/Format-function-destroys-some-of-charts/m-p/106221 

 

 

 

Best Regards

Lucien

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.