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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

SUMX issues - converting from Import to DirectQuery

Hi - I'm hoping someone can help. I'm switching from an Import report to a DirectQuery and recreating the measures I created for the Import tables. One of the measures I have that worked using Import mode is as follows:

 

ProjectBudget = SUMX('projectorders','projectorders'[units]*'projectorders'[unitsell])

This is multiplying the number of units by the sell price of the unit to show the total project budget. The measure works (ie. no errors on the measure itself) however when displayed in a Matrix, it can't display citing an ODBC error and suggesting using a simpler expression. Trouble is, I'm not knowledgeable enough in Power BI to know what that might look like! It seems SUMX perhaps isnt supported in DirectQuery mode but I'm unsure how to acheive the same as I used for Import mode.

 

sirrah_0-1631184601543.png

 

Any help will be very gratefully received! Thanks.

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

I could not reproduce this. I import your data into a SQL Server database and connect to it in Direct Query mode. When I use this measure in a matrix visual, it works well. 

21091402.jpg

 

What data types are your units and unitsell columns in the data source? Do you perform any transformation steps in Power Query Editor? 

 

Regards,
Community Support Team _ Jing

View solution in original post

6 REPLIES 6
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

I could not reproduce this. I import your data into a SQL Server database and connect to it in Direct Query mode. When I use this measure in a matrix visual, it works well. 

21091402.jpg

 

What data types are your units and unitsell columns in the data source? Do you perform any transformation steps in Power Query Editor? 

 

Regards,
Community Support Team _ Jing

Anonymous
Not applicable

After creating a new dataset with the data and not applying any 'type' as 'decimal' to the columns I managed to get this working. Thanks for sowing the seed. I just needed to ensure the columns had the right type set. Thanks so much!

Anonymous
Not applicable

Hi @v-jingzhang , thanks for trying this out. The 'Units' and 'UnitSell' are decimal and currency data types respectively. The source is from a table in Dataverse. The only transformation in power query editor is to filter some rows and rearrange columns.

 

Many thanks.

amitchandak
Super User
Super User

@Anonymous , I think this may be because of line-level calculation which returns more than 1 Million rows.

 

What are expected lines at row level

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi amitchandak - thanks for offering to help - much appreciated.

 

Firstly I have a projectorders table which looks something like this - each one associated with a project ID

Project IDProjectOrdersUnitsUnitSell
exampleprojectID1exampleprojectorderID12£500
exampleprojectID1exampleprojectorderID21£500
exampleprojectID2exampleprojectorderID35£500
exampleprojectID2exampleprojectorderID42£300

 

I'm trying to create a Matrix visual that then contains a list of all the projects but roll up the project budget (units * unit sell) from the project orders associated with the individual projects. The bit is red is where I'm struggling! I've tried using SUMX but it fails when added to a matrix visual in DirectQuery mode (works with import mode).

Project IDProject DescriptionProject ManagerProject budget
exampleprojectID1egProjectDescription1egPMName1£1500 (sum of related ProjectOrders in above table)
exampleprojectID2egProjectDescription2egPMName2£3100

 

I hope that helps explain what I'm trying to acheive!

Anonymous
Not applicable

Sorry - those tables didnt format well once submitted. I'll try again here:

Table:

sirrah_0-1631194026005.png

 

Matrix visual content:

sirrah_1-1631194042423.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors