How about something like this:
------------------
WITH MEMBER [Measures - Fee Rates].[Measures - Fee Rates].[Var] AS
IIF([Academic Year].CURRENTMEMBER.NAME = "2012/13"
, [Measures - Fee Rates].[Measures - Fee Rates].[Enhanced Fee Income] - [Measures - Fee Rates].[Measures - Fee Rates].[Standard Fee Income]
, [Measures - Fee Rates].[Measures - Fee Rates].[Enhanced Fee Income] / [Measures - Fee Rates].[Measures - Fee Rates].[Standard Fee Income]*100
)
SELECT
TM1IGNORE_BADTUPLES NON EMPTY{[Measures - Fee Rates].[Measures - Fee Rates].[Enhanced Fee Income],[Measures - Fee Rates].[Measures - Fee Rates].[Standard Fee Income],[Measures - Fee Rates].[Measures - Fee Rates].[Enhanced Fee Income / Standard Fee Income],[Measures - Fee Rates].[Measures - Fee Rates].[Var]} ON 0
, TM1IGNORE_BADTUPLES NON EMPTY {TM1FILTERBYLEVEL(TM1SUBSETALL([Academic Year].[Academic Year]) , 0)} ON 1 FROM [Fee Actuals] WHERE ([Programme].[Programme].[All Programme], [Fee Status].[Fee Status].[All Fee Status], [Mode].[Mode].[All Mode], [Programme Period].[Programme Period].[All Programme Period], [Start Year].[Start Year].[All Start Year])
----------------------
And then format values as a %. It should work for the sample you gave for gross margin %
The key is in the WITH statement I have an IIF condition which currently if the year is 2012/13 then do a subtraction, for everything else do a division and multiple by 100 to yield a percentage.
You could replace this
[Academic Year].CURRENTMEMBER.NAME = "2012/13"
so that instead of looking at a name it refers to a attribute which dictates if the value is a % or not already and so know which variance is required.
------------------------------
Simon Saul
------------------------------
Original Message:
Sent: Wed January 05, 2022 06:27 PM
From: Denis Barchukov
Subject: cubeview - FORMAT_STRING MDX question
Thanks, James!
Indeed, static formatting in MDX expression works well. And you are right, my issue is not in MDX itself but in an inability to find an option to change dynamically (conditionally) the data type format so I can replicate the web sheet-like in an example below.
GP Margin in this case has 2 different types: percent and customer one (bps). I tried all the options and MDX is my last resort.

------------------------------
Denis Barchukov
Original Message:
Sent: Wed January 05, 2022 06:22 AM
From: James McCarthy
Subject: cubeview - FORMAT_STRING MDX question
Hi Denis,
I have been using the static version above for some time but a dynamic version would clearly be much better. Have tried syntax similar to the above and has never worked for me either.
I assume there is a good reason you have not used rules and formatting using PA rather than MDX.
Rgds
James
------------------------------
James McCarthy
Original Message:
Sent: Tue January 04, 2022 12:26 AM
From: Denis Barchukov
Subject: cubeview - FORMAT_STRING MDX question
Hello, Planning analytics and MDX enthusiast folks!
I am very excited about cube view enhancements and customisation using MDX direct queries. This allows the development of dynamic and custom experiences for users.
The ability to create view specific calculations such as version variances percentage and absolute values is especially useful.
For instance, you can create a conditional calculation where you can define that if the current element of a row dimension is a ratio (ec. COGS%), then apply different variable calculations (bps instead of % variance).
It works splendidly on calculation. However, I have trouble with the correct formatting of the cell. I can not find how to display forms dynamically based on an account.
After googling the issue, it seems that manipulating FORMAT_STRING
value is the key. I can see that people approach the issue in other products using the custom format attribute on rows. However, it seems that it doesn't work in PA. See the working and attempted dynamic example.
//Option 1 Returns the conditional calculation with static format
MEMBER [WxVersion].[WxVersion].[Reporting Versions].[calculation test] AS
CASE
WHEN [WxAccount].[WxAccount].CURRENTMEMBER.PROPERTIES("MEMBER_NAME") = "COGS%" THEN 1 ELSE NULL END, SOLVE_ORDER = 4, FORMAT_STRING = "#0.00000;(#0.000000)"
//Option 2 Returns the conditional calculation with dynamic format
MEMBER [WxVersion].[WxVersion].[Reporting Versions].[calculation test2] AS
CASE
WHEN [WxAccount].[WxAccount].CURRENTMEMBER.PROPERTIES("MEMBER_NAME") = "COGS%" THEN 1 ELSE NULL END, SOLVE_ORDER = 4,
FORMAT_STRING = [WxFinancialMeasure].[WxFinancialMeasure].CURRENTMEMBER.PROPERTIES("Report Format")
Another option is to use MDX Cell Calculations, but I don't believe it is supported yet.
Could anyone advice?
------------------------------
Denis Barchukov
------------------------------
#PlanningAnalyticswithWatson