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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
JesperMadsen90
Regular Visitor

Problem with DISTINCTCOUNT when using DirectQuery since 24 November

I have two Power BI reports, built in Desktop and now up and running in Service, both of them are since 24 of November 2023 not working due to a measure = DISTINCTCOUNT(Customer_Id). My other measures are working fine, and the DISTINCTCOUNT works if I switch to Import Mode, however this is not something I wan't due to the size of the datamodel. The DISTINCTCOUNT have worked just fine i DirectQuery mode before but recently (since 24 Nov 2023) are not working.

 

I get the following message in PBI Service in the visuals where the DISTINCTCOUNT is present.

"Expression.Error: We couldn't fold the expression to the data source. Please try a simpler expression.. ;We couldn't fold the expression to the data source. Please try a simpler expression.. The exception was raised by the IDbCommand interface."

 

Does anyone know the problem? Does it have something to do with the latest update?

 

//Jesper

1 ACCEPTED SOLUTION
JesperMadsen90
Regular Visitor

Problem was formating of the column in the native database, even if Power BI managed to convert the column to a decimal number the distinctcount function didn't work. After changes to the formatting av Customer_Id in our native database the problem was solved.

View solution in original post

3 REPLIES 3
JesperMadsen90
Regular Visitor

Problem was formating of the column in the native database, even if Power BI managed to convert the column to a decimal number the distinctcount function didn't work. After changes to the formatting av Customer_Id in our native database the problem was solved.

Ahmedx
Super User
Super User

pls try this

SUMX(VALUES(Customer_Id),1)
OR
SUMX(DISTINCT(Customer_Id),1)

Thanks, but unfortunately same problem, seems to be to complex for DirectQuery mode.

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.