Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have the following measure:
Status =
VAR _Series_Month =
LEFT(MAX(all_series[series]), SEARCH(" ", MAX(all_series[series])) - 1)
VAR _Key_Markets =
SWITCH(
_Series_Month,
"March",
{"Country1"},
"June",
{"Country2", "Country3", "Country4"},
"November",
{"Country5", "Country6"},
BLANK()
)
VAR _Key_Market_Q =
CALCULATE(
MAX(key_Customer_Entries[Q%]),
key_Customer_Entries[country] IN _Key_Markets,
key_Customer_Entries[ses_name] = MAX(all_series[series])
)
RETURN
_Key_Market_Q
However, I keep getting the following error:
The function expects a table expression for argument '', but a string or numeric expression was used.
How do I pass the values from _Key_Markets into _Key_Market_Q correctly?
Solved! Go to Solution.
Hi @RyanHare92 ,
You can follow the steps to get it:
1. Create a dimension table as below
2. Update the formula of your measure[Status] as below
Status =
VAR _Series_Month =
LEFT (
MAX ( all_series[series] ),
SEARCH ( " ", MAX ( all_series[series] ) ) - 1
)
VAR _Key_Markets =
CALCULATETABLE (
VALUES ( 'Table'[Countries] ),
FILTER ( 'Table', 'Table'[Month] = _Series_Month )
)
VAR _Key_Market_Q =
CALCULATE (
MAX ( key_Customer_Entries[Q%] ),
key_Customer_Entries[country] IN _Key_Markets,
key_Customer_Entries[ses_name] = MAX ( all_series[series] )
)
RETURN
_Key_Market_Q
If the above one can't help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with special examples and screenshots. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi @RyanHare92 ,
You can follow the steps to get it:
1. Create a dimension table as below
2. Update the formula of your measure[Status] as below
Status =
VAR _Series_Month =
LEFT (
MAX ( all_series[series] ),
SEARCH ( " ", MAX ( all_series[series] ) ) - 1
)
VAR _Key_Markets =
CALCULATETABLE (
VALUES ( 'Table'[Countries] ),
FILTER ( 'Table', 'Table'[Month] = _Series_Month )
)
VAR _Key_Market_Q =
CALCULATE (
MAX ( key_Customer_Entries[Q%] ),
key_Customer_Entries[country] IN _Key_Markets,
key_Customer_Entries[ses_name] = MAX ( all_series[series] )
)
RETURN
_Key_Market_Q
If the above one can't help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with special examples and screenshots. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
This is a dilemma. The SWITCH statement cannot return objects, only simple data types.
You need to refactor the query to pull the switch into the final step, or use SEARCH instead with a string concatenation of your match terms.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |