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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
HxH
Advocate II
Advocate II

Formatting different results in a single measure

Hi everyone,
I have created the following measure which, according to the selection made in a "fake" filter (fake because it is not actually propagating any filter context, it is just a parameter table to activate the selectedvalue function), shows a different measure 

Kpi =

SWITCH(
TRUE(),
SELECTEDVALUE(FilterTable[Parameter]) = "Leads Managed", [Leads Managed],
SELECTEDVALUE(FilterTable[Parameter]) = "Quotations", [Quotations],
SELECTEDVALUE(FilterTable[Parameter]) = "Contracts", [Contracts],
SELECTEDVALUE(FilterTable[Parameter]) = "Quotation Rate", [Quotation Rate],
SELECTEDVALUE(FilterTable[Parameter]) = "Selling Rate", [Selling Rate],
[Leads Managed]
)

The measure works fine, acting exaclty as a filter but working as a "KPI" picker in a bar chart. The only problem is that some of these measures results are whole numbers and some are percentages (the two rate measures).

The original measures are correctly formatted but the problem is that the formatting of the KPI measure overwrites the format settings of the measures! Therefore if I select number as formatting, percentages are show as 0.03, while if I choose percentage as formatting, numbers are show as 700K% 

I would like to know if there is a way I can avoid this kind of behaviour and show the correct formatting for each measure picked.

Thanks
1 ACCEPTED SOLUTION
MartynRamsden
Solution Sage
Solution Sage

Hi @HxH 

 

Unfortunatley, this is currently a limitation in Power BI.

There's a popular idea over at ideas.powerbi.com - make sure you vote it up: ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/15231165-conditional-formatted-measures-u... 


If your measure will be displayed in a table, you can use the FORMAT function within your SWITCH expression to make a string.

For example:

Kpi =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Leads Managed", [Leads Managed],
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Quotations", [Quotations],
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Contracts", [Contracts],
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Quotation Rate", FORMAT ( [Quotation Rate], "0.0%" ),
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Selling Rate", FORMAT ( [Selling Rate], "0.0%" ),
    [Leads Managed]
)

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

View solution in original post

2 REPLIES 2
MartynRamsden
Solution Sage
Solution Sage

Hi @HxH 

 

Unfortunatley, this is currently a limitation in Power BI.

There's a popular idea over at ideas.powerbi.com - make sure you vote it up: ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/15231165-conditional-formatted-measures-u... 


If your measure will be displayed in a table, you can use the FORMAT function within your SWITCH expression to make a string.

For example:

Kpi =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Leads Managed", [Leads Managed],
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Quotations", [Quotations],
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Contracts", [Contracts],
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Quotation Rate", FORMAT ( [Quotation Rate], "0.0%" ),
    SELECTEDVALUE ( FilterTable[Parameter] ) = "Selling Rate", FORMAT ( [Selling Rate], "0.0%" ),
    [Leads Managed]
)

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

Hi, 
thanks for the reply, I'll definitely vote for the idea.

I had already thought about that solution and tried it out but as you said it only works in a table and not as a "data label" formatter in a chart of any kind.

Thanks anyway

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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