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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
wolfgang2
Frequent Visitor

ValueFormatter ignoring culture

I have an issue with valueFormatter where it ignores the specified culture and always defaults to "en-US":

import { valueFormatter } from "powerbi-visuals-utils-formattingutils";
...
formatter = valueFormatter.create({ value: 1000, precision: 1, cultureSelector: "de-DE" });
formattedValue = formatter.format(3400);

This results in 3.4K instead of 3,4 Tsd.
1 ACCEPTED SOLUTION

If the separator/decimal symbols are right after making the changes, it's probably "working." Unfortunately, I'm not best placed to determine how far it goes for the units, as English is my first language. During testing, I have only really confirmed the units match what *I* might expect (although I have a rudimentary understanding of which separators are needed for various locales). It is known that there are some cases where, even if all locales are bundled, Power BI doesn't provide the correct locale to the visual host (e.g., Swiss German, or de-CH), but it does supply de-DE correctly.

 

MS uses the Globalize library to handle localization in powerbi-visuals-utils-formatingutils, and from a cursory look, I think the unit handling is not culture-specific. If you want a definitive answer, your best bet would be to check directly with MS (pbicvsupport@microsoft.com).

 

All the best,

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

3 REPLIES 3
wolfgang2
Frequent Visitor

Hello, @dm-p 
Your suggestions fixed the issue but only partially. With the locales included, the valueFormatter is giving the correct thousands separator and decimal symbols based on the current locale. However, the units for thousand, million, billion (K, M, bn etc.) are not correct. Is this even supported? I decided to include specific locales. Thanks for the help anyway!

If the separator/decimal symbols are right after making the changes, it's probably "working." Unfortunately, I'm not best placed to determine how far it goes for the units, as English is my first language. During testing, I have only really confirmed the units match what *I* might expect (although I have a rudimentary understanding of which separators are needed for various locales). It is known that there are some cases where, even if all locales are bundled, Power BI doesn't provide the correct locale to the visual host (e.g., Swiss German, or de-CH), but it does supply de-DE correctly.

 

MS uses the Globalize library to handle localization in powerbi-visuals-utils-formatingutils, and from a cursory look, I think the unit handling is not culture-specific. If you want a definitive answer, your best bet would be to check directly with MS (pbicvsupport@microsoft.com).

 

All the best,

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




dm-p
Super User
Super User

Hi @wolfgang2,

 

Are you specifying --all-locales (or bundling de-DE) when running developer mode or packaging your visual? Recently, the tools omit locales due to their size when packaging and you must specify which to include. You can manually specify locales to include by adding an empty stringResources file for your desired languages, as detailed here. Personally, I run my dev and package commands with --all-locales, as despite the size, this provides the best overall support for global users if publishing to AppSource. If your visual is intended for a private audience, then it may be better just to add the locales you need.

 

Cheers,

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors
Top Kudoed Authors