Forum Discussion

gsmith_eqd's avatar
gsmith_eqd
Frequent Visitor
3 years ago

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

  • m3tr01d's avatar
    m3tr01d
    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.

    • gsmith_eqd's avatar
      gsmith_eqd
      Frequent Visitor

      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")