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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Frumpy
Frequent Visitor

FORMAT "Percent" with SWITCH changes visible rows in Table

Hi all,

I have created a SWITCH measure that shows values in a table based on the selection of a slicer with reporting periods:

 

SwitchReportingPeriod Decisions % Timely:= 
 
VAR SVReportingPeriod = SELECTEDVALUE('Calendar'[ReportingPeriod])
VAR Result = 
 
SWITCH(
    TRUE(),
    SVReportingPeriod= "Whole Year",
CALCULATE(
[Decisions % Timely],
Period[TypeID] = 1, ALL('Calendar'), CROSSFILTER(Period[Date],'Calendar'[Date],Both)
),
 
    SVReportingPeriod = "First four months" || SVReportingPeriod = "First eight months",
CALCULATE(
[Decisions % Timely],
Period[TypeID] = 2, 
ALL('Calendar'), CROSSFILTER(Period[Date],'Calendar'[Date],Both)
)
 )
RETURN
Result

This measure appears to be working just as I expect.
 
When the slicers has selected "Whole Year" (Period[TypeID] = 1), then the table looks like this:
Frumpy_0-1692347608231.png

When the slicer has selected "First four months" or "First eight months" (Period[TypeID] =2), the table looks like this:

Frumpy_1-1692347742317.png

 

Now since I want to show this measure formatted in percentage, I tried the following, both as a separate measure:
FORMATSwitchReportingPeriod Decisions % Timely:=
FORMAT([SwitchReportingPeriod Decisions % Timely], "Percent")

 
As in the Return statement of the measure itself:
RETURN FORMAT(Result, "Percent")

This both causes the table to show all reporting periods in the rows, but only show the corresponding values based on the slicer selection.

When selected Reporting Period = "Whole Year" (Period[TypeID] = 1):
Frumpy_2-1692348618552.png

When selected Reporting Period = "First four months" or "First eight months" (Period[TypeID] =2)

Frumpy_3-1692348717440.png

Now I am pretty new at DAX and PowerBI so I don't understand why this happens and how to fix it.

Hope someone can help! Thanks a bunch in advance!

 
1 ACCEPTED SOLUTION
Prateek97
Resolver III
Resolver III

Hi @Frumpy ,

 

Can you try changing your formatted measure like below:


IF(

ISBLANK([SwitchReportingPeriod Decisions % Timely],

                 BLANK(),

FORMAT([SwitchReportingPeriod Decisions % Timely], "Percent")

)

 

Please mark as a solution, if it works.

View solution in original post

3 REPLIES 3
mlsx4
Memorable Member
Memorable Member

Hi @Frumpy 

 

Why don't you change the format in Data View? 

mlsx4_0-1692353791224.png

And you click on the measure % Timely and button %

mlsx4_1-1692353835827.png

 

Frumpy
Frequent Visitor

Hi mlsx4,

Thanks for your answer, sorry I failed to provide full information, but my data model is not actually in PowerBI, it's in SSAS. So unfortunately this formatting isn't an option. 

Prateek97
Resolver III
Resolver III

Hi @Frumpy ,

 

Can you try changing your formatted measure like below:


IF(

ISBLANK([SwitchReportingPeriod Decisions % Timely],

                 BLANK(),

FORMAT([SwitchReportingPeriod Decisions % Timely], "Percent")

)

 

Please mark as a solution, if it works.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors