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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
gsmith_eqd
Frequent Visitor

Internal Error - complex expression must be simplified?

I have created this measure which selects either qtyshorttoship, qtyshortofsold, or buffer, depending on whether each value is greater than 0. Then it takes that value and subtracts from it 3 measures which represent the sum of items in stock or in progress.

 

VAR __input = IF([QtyShortToShip] > 0, [QtyShortToShip], IF([QtyShortOfSold] > 0, [QtyShortOfSold], [Buffer]))
VAR __result = __input - [WIR Stock] - [ASY In Progress] - [ASY Stock]
RETURN

IF(__result > 0, __result, BLANK())

 

However, the visual cannot be displayed. I'm thrown an error message: "Internal error: an expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.. The exception was raised by the IDbCommand interface."

 

How should I approach simplifying this expression?

2 REPLIES 2
m3tr01d
Continued Contributor
Continued Contributor

Hi

Unfortunately it is very difficult to help you if you don't give us the definition of all the measures
[QtyShortToShip]
[QtyShortOfSold]
[Buffer]
[WIR Stock]
[ASY In Progress]
[ASY Stock]

Then, we might be able to help you.

I can provide that, but since posting this I made another realization: the measure fails to load just this portion alone:

 

IF([QtyShortToShip] > 0, [QtyShortToShip], IF([QtyShortOfSold] > 0, [QtyShortOfSold], [Buffer]))

 

Maybe that gives another clue. Here are the definitions for those measures and the measures that are used within them:

 

QtyShortToShip = SUM(ProductionItems[QtyShipping]) - [Finished Stock]

QtyShortOfSold = [Sold] - [Finished Stock]

Finished Stock = CALCULATE(SUM(InventoryMaster[Qty]), LocationMaster[Code] IN {"FIN1", "FIN1C", "FIN1I"})

Buffer = SUM(ProductionItems[BufferQty])

Sold = SUM(DocumentLine[QtyToShip])

WIR Stock = CALCULATE(SUM(InventoryMaster[Qty]), ItemMaster[Stage] = "WIR", LocationMaster[LocationType] = 2)

ASY Stock = CALCULATE(SUM(InventoryMaster[Qty]), ItemMaster[Stage] = "ASY", LocationMaster[LocationType] = 2)

ASY In Progress = CALCULATE(SUM(ProductionRun[QtyAssigned]), ProductionRun[CloseDate] = BLANK(), ProductionRun[ProductionStage] = "ASY")

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.