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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
RavenQueen0311
Frequent Visitor

Switch statement not working, Individual measures are

Good Morning,

 

I'm having an issue with a Switch Statement in one of my reports.  The Switch Statement is supposed to look at a column in the table and return the value of a specific measure based on the value of that column.  Most of the time, this works just fine, but when certain dates or other filters are applied, it simply returns a blank field instead of the measure value.  I've validated that the underlying measures calculate correctly if they are placed in a Card on their own, but not when part of the Switch Statement.
 

RavenQueen0311_0-1654188297298.png

 

The Switch statement is as follows:

 

Current Accounts Switch = 
SWITCH (
    SELECTEDVALUE ( Accounts_Table[SubCategory] ),
    "Enrollments", FORMAT ( 'PATRON EXPANDED FINANCIAL DETAIL'[Current Enrollments], "#,##0" ),
    "Active 30", FORMAT ( 'PATRON EXPANDED FINANCIAL DETAIL'[Active 30 Current], "#,##0" ),
    "Active 60", FORMAT ( 'PATRON EXPANDED FINANCIAL DETAIL'[Active 60 Current], "#,##0" ),
    "Active 90", FORMAT ( 'PATRON EXPANDED FINANCIAL DETAIL'[Active 90 Current], "#,##0" )
)

 

I am unsure what may be wrong here.  Any help is appreciated.

1 ACCEPTED SOLUTION
RavenQueen0311
Frequent Visitor

Hello, I have solved this issue myself.  In my case, the issue was created by an incorrect relationship in my data model that caused certain peices of data to rely on unrelated tables in the model.  Once I cleared the relationship, this issue was fixed.

 

Thank you to everyone for their time.

View solution in original post

3 REPLIES 3
RavenQueen0311
Frequent Visitor

Hello, I have solved this issue myself.  In my case, the issue was created by an incorrect relationship in my data model that caused certain peices of data to rely on unrelated tables in the model.  Once I cleared the relationship, this issue was fixed.

 

Thank you to everyone for their time.

v-zhangti
Community Support
Community Support

Hi, @RavenQueen0311 

 

Can you provide some sample data or simple pbix files? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures.

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@RavenQueen0311 , I would advise to use field parameters and do formatting using the property pane in the model view 

 

https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.