Forum Discussion

eiashken's avatar
eiashken
Microsoft Employee
6 years ago

cosmosdb in PowerBI SQL Statement

I have been trying to add an SQL statement during CosmosDB connection to save time and performance in aggregation.
I got an error that says that I have an error in my errors table..
But the query works in cosmosDB!
Only in POWerBI I have this error... why?
 
SELECT SUBSTRING(c.created, 0, 7) as month,c.status,count(1) as count
FROM c
group by SUBSTRING(c.created, 0, 7),c.status

3 Replies

  • v-kelly-msft's avatar
    v-kelly-msft
    Community Support

    Hi eiashken

     

    What is the error you are getting?In which connection mode do you choose before connecting to CosmosDB?"Import "or "Directquery"?

     

    Best Regards,

    Kelly

    • eiashken's avatar
      eiashken
      Microsoft Employee

      Where can I choose these options?

      • v-kelly-msft's avatar
        v-kelly-msft
        Community Support

        Hi eiashken

         

        Try the following steps to do the troubleshooting:

         

        1.If you dont add the statement, is it available to connect the data source?

        2.Have you installed  Cosmos DB ODBC driver?Are you using ODBC Connector in desktop such as below?

         For references,pls click here.

         

         
         
        Do check all the questions above,if there still has some errors ,pls advise me what the error you are getting?
         
        Best Regards,
        Kelly