Forum Discussion
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.
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.
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.
3 Replies
- RavenQueen0311Frequent 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.
- amitchandakSuper User
RavenQueen0311 , I would advise to use field parameters and do formatting using the property pane in the model view
- v-zhangtiCommunity 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.