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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
v-likosh
Microsoft Employee
Microsoft Employee

Error while using SQL queries in Power BI

Following query works fine within cosmosDB:
SELECT
COUNT(1) AS dcount_ip, c.AlertType, c.SubscriptionId, c.BinByDay
FROM(
SELECT
DISTINCT a.AlertObject.Metadata.cip AS d_cip,
a.AlertObject.AlertType,
a.AlertObject.ExtendedProperties.SubscriptionId,
DateTimeBin(a.ProcessingEndTimeUtc,'day') AS BinByDay
FROM Alert a
WHERE a.IsValidAlert = true) c
GROUP BY c.AlertType, c.SubscriptionId, c.BinByDay

However, when I am submitting this query through PoerBI SQL box at the time of fetching the data, it is failing.

vlikosh_1-1669074570689.png

 



Error message: 

DataSource.Error: Cross partition query only supports 'VALUE <AggregateFunc>' for aggregates.

vlikosh_0-1669074526187.png

 






4 REPLIES 4
Uspace87
Resolver III
Resolver III

Try to use Value Count(1) as per below:

 

 

SELECT
Value COUNT(1) AS dcount_ip, c.AlertType, c.SubscriptionId, c.BinByDay
FROM(
SELECT
DISTINCT a.AlertObject.Metadata.cip AS d_cip,
a.AlertObject.AlertType,
a.AlertObject.ExtendedProperties.SubscriptionId,
DateTimeBin(a.ProcessingEndTimeUtc,'day') AS BinByDay
FROM Alert a
WHERE a.IsValidAlert = true) c
GROUP BY c.AlertType, c.SubscriptionId, c.BinByDay

Hello @Uspace87 ,

The above code did not help in resolving the error and I still get the same error.

v-yanjiang-msft
Community Support
Community Support

Hi @v-likosh ,

Please see if the solution in the below similar thread can help:

DocumentDb error "Cross partition query only supports 'VALUE <AggreateFunc>' for aggregates" - Stack...

DocumentDb error Cross partition query only supports VALUE AggreateFunc for aggregates - SQL - YouTu...

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-yanjiang-msft ,

The provided solution did not work in my case.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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