Forum Discussion
Power BI JavaScript API userculture does not work correctly today multi-language reports
When we embed a report we perform the following:-
const lang = this.user ? this.user.profile['locale'] : 'en-GB';
const config: any = {
type: 'report',
id: this.id,
embedUrl: this.embedUrl,
accessToken: this.accessToken,
tokenType: pbi.models.TokenType.Embed,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true,
layoutType: this.layout,
localeSettings: {
language: lang,
formatLocale: lang
}
}
};
const divElement: HTMLElement = <HTMLElement>this.powerBIReports.nativeElement;
this.powerbi.reset(divElement);
this.report = this.powerbi.embed(divElement, config);
You can see from the example above that we are passing a culture in the localeSettings
Within our report itself we have a dax expression similar to:-
VAR UC = CALCULATE(MIN(usercultures[Locale]),FILTER(usercultures,usercultures[Code] = USERCULTURE()))
Return UC
The USERCULTURE() no longer resolves to the culture passed in when embedded (see highlighted red), it evaluates as en-US
We have also logged this as a ticket with Microsoft.
Hi, I am experiencing the same issue now, with powerbi js client v. 2.23.1. USERCULTURE() is not reflecting the specified localeSettings in embedded mode. Did this eventually work for you (long time ago now I realize...)?