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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kaarel
Resolver I
Resolver I

SCOPE() format_string problem SSAS live

Hi!

 

I think I found a bug. 

 

I've got 2 measures with 2 different format strings. "Margin" with #,##0 and "Margin SEK" with #,##0'kr'. The latter represents Swedish currency. 

 

In the script I switch between measures based on what currency is selected from the Currency dimension.


SCOPE
(
[Currency].[Currency].&[8],
[Measures].[Margin]
);

THIS=[Measures].[Margin SEK];

END SCOPE;

 

PowerBI doesn't show the format string correctly when "Margin SEK" is with #,##0'kr'. When I switch over to #,##0 for both measures, then it works. 

 

Thanks,

Kaarel.

7 REPLIES 7
gfuribondo
Microsoft Employee
Microsoft Employee

Yo.  Microsoft.  Any word on this?

Maybe we could start a bug report or smt?

sergezai
New Member

I have a similar problem with scope() and formatting  values in PowerBI. I found that any scope statement in SSAS cube actually screws up the formatting of any measure defined before the scope statement. Microsoft confirmed that it's a bug in Power BI but they didn't provide any further details when it's gonna be fixed.

I had a simular issue, and thanks to your post I was able to solve my problem, by putting all the scopes before the creation of the calculated members.

Hopefully soon...

kaarel
Resolver I
Resolver I

And another example... I've got a calculation defined with a format string. Once I remove SCOPE() assignments, then PowerBI

shows the format string correctly. Otherwise it doesn't.

 

CREATE MEMBER CURRENTCUBE.[Measures].[Invoice Rowtotal - last year]
AS [Rowtotal LY],
FORMAT_STRING = "#,##0",
FORE_COLOR = 9079434 /*R=138, G=138, B=138*/ ,
VISIBLE = 1 , DISPLAY_FOLDER = 'Revenue\EUR' , ASSOCIATED_MEASURE_GROUP = 'Invoice Line';

 

SCOPE(DESCENDANTS([Date].[Year-Week-Date],,AFTER));
[Measures].[Invoice Rowtotal - last year] = SUM(EXISTING [Weeks],(PARALLELPERIOD([Date].[Year-Week-Date].[Year],1,[Date].[Year-Week-Date].CurrentMember),[Measures].[Invoice Rowtotal]));
END SCOPE;

 

SCOPE(DESCENDANTS([Date].[Year-Week-Date],,Leaves));
[Measures].[Invoice Rowtotal - last year] = null;
END SCOPE;

 

SCOPE(DESCENDANTS([Date].[Year-Quarter-Month-Date],,Leaves));
[Measures].[Invoice Rowtotal - last year] = null;
END SCOPE;

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.