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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous_10
Frequent Visitor

Run a query against a dataset syntax error

Hi Team,

I needed to export data from power bi semantic model to a SP list. So I tried to use Run a query against a dataset actio n but I keep getting error.I am trying to get Power Automate to generate an output from a query against a Power BI dataset. With a test dataset containing a table named User email (Export), I have tried:

/ DAX Query
DEFINE
VAR __DS0Core = 
SUMMARIZECOLUMNS(
ROLLUPADDISSUBTOTAL(
ROLLUPGROUP('User email (Export)'[User email], 'User email (Export)'[Domain]), "IsGrandTotalRowTotal"
),
"SumWith_activities", CALCULATE(SUM('User email (Export)'[With activities])),
"SumOnly_view_activities_in_premium_workspace", CALCULATE(SUM('User email (Export)'[Only view activities in premium workspace])),
"SumAssigned_to_workspace", CALCULATE(SUM('User email (Export)'[Assigned to workspace])),
"SumAccount_enabled", CALCULATE(SUM('User email (Export)'[Account enabled]))
)
 
 
 
EVALUATE
__DS0Core
 
ORDER BY
[IsGrandTotalRowTotal] DESC,
'User email (Export)'[User email],
'User email (Export)'[Domain]

But the Actual Query was:

// DAX Query
DEFINE
VAR __DS0Core = 
SUMMARIZECOLUMNS(
ROLLUPADDISSUBTOTAL(
ROLLUPGROUP('User email (Export)'[User email], 'User email (Export)'[Domain]), "IsGrandTotalRowTotal"
),
"SumWith_activities", CALCULATE(SUM('User email (Export)'[With activities])),
"SumOnly_view_activities_in_premium_workspace", CALCULATE(SUM('User email (Export)'[Only view activities in premium workspace])),
"SumAssigned_to_workspace", CALCULATE(SUM('User email (Export)'[Assigned to workspace])),
"SumAccount_enabled", CALCULATE(SUM('User email (Export)'[Account enabled]))
)
 
VAR __DS0PrimaryWindowed = 
TOPN(
502,
__DS0Core,
[IsGrandTotalRowTotal],
0,
'User email (Export)'[User email],
1,
'User email (Export)'[Domain],
1
)
 
EVALUATE
__DS0PrimaryWindowed
 
ORDER BY
[IsGrandTotalRowTotal] DESC,
'User email (Export)'[User email],
'User email (Export)'[Domain]

The keep getting error message like: 
{
"error": {
"code": "DatasetExecuteQueriesError",
"pbi.error": {
"code": "DatasetExecuteQueriesError",
"parameters": {},
"details": [
{
"code": "DetailsMessage",
"detail": {
"type": 1,
"value": "Query (8, 40) Column '<oii>With activities</oii>' in table '<oii>User email (Export)</oii>' cannot be found or may not be used in this expression."
}
},
{
"code": "AnalysisServicesErrorCode",
"detail": {
"type": 1,
"value": "3241803780"
}
}
]
}
}
}
Screenshot 2025-02-21 105142.png
What is missing? Could anyone please help me?
Thanks,



 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Multiple issues here.  When running DAX queries you want to make them as simple and tabular as possible.  Use a table visual without totals.  Don't use a matrix visual as the basis.

 

Also, the ORDER BY clause is highly pointless and adds to the computational complexity.  Omit that whereever possible.

 

Use the DAX Query View or DAX Studio to simplify your DAX code before transferring the query to Power Automate or other external query tools.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous_10 
We wanted to follow up since we haven't heard back from you regarding our last response. We hope your issue has been resolved. If our answer resolved your query, please mark it as "Accept as Solution" and select "Yes" if it was helpful.If you need any further assistance, feel free to reach out.

Thank you for being a valued member of the Microsoft Fabric Community Forum!

Hi @Anonymous 
Sorry for delay in my response. I have been out of the town and I marked "accepted" for the solution provided by @lbendlin .
Thanks for the prompt response @lbendlin and @Anonymous thanks for the follow up.

Anonymous
Not applicable

Hi @Anonymous_10 ,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.

Thank you for being a valued member of the Microsoft Fabric Community Forum!

Anonymous
Not applicable

Hi @Anonymous_10 ,

I trust the @lbendlin response is accurate and will address your issue.

If you have any further questions or updates regarding your issue, feel free to ask, and we will look into that.

If the answer meets your requirements, please consider marking it as Accept as solution.

Thank you for being a valued member of the Microsoft Fabric Community Forum!

lbendlin
Super User
Super User

Multiple issues here.  When running DAX queries you want to make them as simple and tabular as possible.  Use a table visual without totals.  Don't use a matrix visual as the basis.

 

Also, the ORDER BY clause is highly pointless and adds to the computational complexity.  Omit that whereever possible.

 

Use the DAX Query View or DAX Studio to simplify your DAX code before transferring the query to Power Automate or other external query tools.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors