Forum Discussion
Need help with DAX code, performance problem
- Anonymous5 years ago
I have found the problem in the switch statement.
After changing the switch statement to this, it is working.
Metric to show:=
SWITCH(
SELECTEDVALUE(Dynamic_Metrics[Metric Name], "All/No selected"),
"# of rows with Police dispatched by",[# of rows with Police dispatched by],
"# of rows with Fire dispatched by",[# of rows with Fire dispatched by],
"# of rows with Guard dispatched by",[# of rows with Guard dispatched by],
"# of rows with Guard dispatched cancelled by",[# of rows with Guard dispatched cancelled by],
"# of rows with Sms sent by",[# of rows with Sms sent by],
"# of rows with First ACK by",[# of rows with First ACK by],
[# of rows with Guard dispatched by]
)
Hi Anonymous
Can you share the pbix? Otherwise:
Can you show the code for [Selected Metric Name]?
Can you show where you are using the measure (what visual, what fields are in the visual and the relevant tables)?
What exactly do you mean by "keep my filters"?
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
I have created a testfile, but I can't find how to upload it here. Do you know how to do that?
- Anonymous5 years agoNot applicable
I have found the problem in the switch statement.
After changing the switch statement to this, it is working.
Metric to show:=
SWITCH(
SELECTEDVALUE(Dynamic_Metrics[Metric Name], "All/No selected"),
"# of rows with Police dispatched by",[# of rows with Police dispatched by],
"# of rows with Fire dispatched by",[# of rows with Fire dispatched by],
"# of rows with Guard dispatched by",[# of rows with Guard dispatched by],
"# of rows with Guard dispatched cancelled by",[# of rows with Guard dispatched cancelled by],
"# of rows with Sms sent by",[# of rows with Sms sent by],
"# of rows with First ACK by",[# of rows with First ACK by],
[# of rows with Guard dispatched by]
)