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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.