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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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,



 

3 REPLIES 3
v-pagayam-msft
Community Support
Community Support

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!

v-pagayam-msft
Community Support
Community Support

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