Forum Discussion

uarora's avatar
uarora
New Member
2 years ago

Formatting issue when using switch for number and percentage measures together

Hello,

 

I am creating a Power BI report in which there are multiple measures being switched using a slicer. Screenshot below:

 

The issue that I am facing is with the formatting of numbers and percentage metrics. The numeric measures work fine but the percentages get displayed as a decimal. Screenshots below:

Below is the dax for the measure that allows to switch between all the measures:

 

CYVal = SWITCH(TRUE(),  

    [SelectMetric] = "Clinic Revenues", [Production],
    [SelectMetric] = "Total Marketing Spend", [Expense (CY)],
    [SelectMetric] = "Marketing Spend as % of Revenue", [Marketing spend as % Revenues (CY)],
    [SelectMetric] = "Total New Patients", [Total New Patients],
    [SelectMetric] = "Cost per Total New Patients", [Cost Per Total New Patient (CY)],
    [SelectMetric] = "New Patients", [New Patients],
    [SelectMetric] = "Cost Per New Patient", [Cost Per New Patient],
    [SelectMetric] = "Referral Source Marketing %", [Ref Source Mkt %],
    [SelectMetric] = "New Patients from Marketing", [New Patients Mkt],
    [SelectMetric] = "Cost per New patients from Marketing", [Cost Per Total New Patient Mkt (CY)],
    [SelectMetric] = "Active Patients", [Active Patients],
    [SelectMetric] = "Returned Patients as % of New", [Returned Patients as % of New],
    [SelectMetric] = "Total New Patients X 12 as % of Active Patients", [Total New Patients Annual % of Active],
    [SelectMetric] = "Lost Patients X 12 as % of Active Patients", [Lost Patients Annual % of Active]
)

 

 
The format of the CYVal measure is set to General. Formatting of the internal measures differs like for New Patients it is whole number whereas for Ref Source Mkt % it is set to Percentage.
 
The DAX format function will not work here since that returns a text output and we need numbers to get the columns. Please assist if anyone can. Thanks.