The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
While executing a DAX query in a Fabric notebook, an error occurred. The query was intended to evaluate and select specific columns from the 'Inventory Item Coverage' table. The code snippet used is as follows:
query = """
EVALUATE
SELECTCOLUMNS(
'Inventory Item Coverage',
"Minimum", 'Inventory Item Coverage'[Minimum],
"Maximum", 'Inventory Item Coverage'[Maximum] )
"""
df_inventory_coverage = fabric.evaluate_dax(query, workspace="ff252d1e-ac76-4df5-8a81-3ca36c28fb5f")
Also, I tried this code as well, it does not work:
query = """
EVALUATE
SELECTCOLUMNS(
'Inventory Item Coverage',
"Minimum", 'Inventory Item Coverage'[Minimum],
"Maximum", 'Inventory Item Coverage'[Maximum]
)
"""
df_inventory_coverage = fabric.evaluate_dax(query, workspace="ff252d1e-ac76-4df5-8a81-3ca36c28fb5f")]
Solved! Go to Solution.
Hi @js15,
Thank you for reaching out to the Microsoft Fabric Community Forum.
You are encountering a TypeError when running your DAX query in a Fabric notebook. You are trying to retrieve the Minimum and Maximum columns from the 'Inventory Item Coverage' table using the SELECTCOLUMNS function.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
Hey @js15 ,
for me this looks as you missed the name of the semantic model in your evaluate_dax call.
This is a working example from one of my notebooks:
workspace_guid = "<the guid of my workspace>"
DAX_querystring = """
EVALUATE
CALCULATETABLE(
SUMMARIZECOLUMNS(
'Product'[Brand],
"Sales Amount", CALCULATE([Sales Amount]),
"Sales Amount Plan", CALCULATE([Sales Amount Plan]),
"Sales Amount PY", CALCULATE([Sales Amount PY])
)
, 'Date'[Year] = 2024
)
"""
df_daxquery = fabric.evaluate_dax(
"learning Deneb - Contoso 1M - SQL Konferenz 2025",
DAX_querystring,
workspace_guid
)
df_daxquery
And an excerpt from the result:
Here you will find the explanation of the evaluate_dax: https://learn.microsoft.com/en-us/python/api/semantic-link-sempy/sempy.fabric?view=semantic-link-pyt...
Hopefully, this helps to tackle your challenge.
Regards,
Tom
Hey @js15 ,
for me this looks as you missed the name of the semantic model in your evaluate_dax call.
This is a working example from one of my notebooks:
workspace_guid = "<the guid of my workspace>"
DAX_querystring = """
EVALUATE
CALCULATETABLE(
SUMMARIZECOLUMNS(
'Product'[Brand],
"Sales Amount", CALCULATE([Sales Amount]),
"Sales Amount Plan", CALCULATE([Sales Amount Plan]),
"Sales Amount PY", CALCULATE([Sales Amount PY])
)
, 'Date'[Year] = 2024
)
"""
df_daxquery = fabric.evaluate_dax(
"learning Deneb - Contoso 1M - SQL Konferenz 2025",
DAX_querystring,
workspace_guid
)
df_daxquery
And an excerpt from the result:
Here you will find the explanation of the evaluate_dax: https://learn.microsoft.com/en-us/python/api/semantic-link-sempy/sempy.fabric?view=semantic-link-pyt...
Hopefully, this helps to tackle your challenge.
Regards,
Tom
Hi @js15,
Thank you for reaching out to the Microsoft Fabric Community Forum.
You are encountering a TypeError when running your DAX query in a Fabric notebook. You are trying to retrieve the Minimum and Maximum columns from the 'Inventory Item Coverage' table using the SELECTCOLUMNS function.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
Thank you, this really helps a lot!