Forum Discussion

eunji888888's avatar
eunji888888
Frequent Visitor
2 years ago

Visual has exceeded the available resources

After i used the below measure, it give me "Visual has exceeded the available resources. Any solution for that? i have already only filtered the neceassary data.
claim2 =
VAR scenario1 =
    SUMX (
        FILTER (
            'by SO',
            LEFT ( 'by SO'[Reason Description], 2 ) <> "Gx"
        ),
        'by SO'[*NetCase] * 'by SO'[number2]
    )
VAR netCaseSum =
    SUMX(
        ALLEXCEPT('by SO', 'by SO'[BillingDocNo]),  
        'by SO'[*NetCase]
    )
VAR isInOOSList =
    COUNTROWS (
        FILTER (
            '2024 OOS',
            '2024 OOS'[InvoiceDate] = SELECTEDVALUE('by SO'[InvoiceDate]) - 7
            && NOT ISBLANK ( '2024 OOS'[#EAN] )
        )
    ) > 0
RETURN
    SWITCH (
        TRUE (),
        netCaseSum >= 2, scenario1,
        netCaseSum = 1 && isInOOSList, scenario1,
        netCaseSum = 1 && NOT isInOOSList, 0,
        0
    )

 

2 Replies

  • eunji888888 , Try with these changes

     

    claim2 =
    VAR _date =SELECTEDVALUE('by SO'[InvoiceDate]) - 7
    VAR netCaseSum =
    SUMX(
    VALUES('by SO'[BillingDocNo]),
    CALCULATE(SUM('by SO'[*NetCase]))
    )
    VAR isInOOSList =
    CALCULATE(
    COUNTROWS('2024 OOS'),
    FILTER(
    '2024 OOS',
    '2024 OOS'[InvoiceDate] = _date
    && NOT ISBLANK('2024 OOS'[#EAN])
    )
    ) > 0
    VAR scenario1 =
    SUMX(
    FILTER(
    'by SO',
    LEFT('by SO'[Reason Description], 2) <> "Gx"
    ),
    'by SO'[*NetCase] * 'by SO'[number2]
    )
    RETURN
    SWITCH(
    TRUE(),
    netCaseSum >= 2, scenario1,
    netCaseSum = 1 && isInOOSList, scenario1,
    netCaseSum = 1 && NOT isInOOSList, 0,
    0
    )

  • Hey eunji888888 ,

     

    the below measure has two versions of DAX code,

    ALLEXCEPT as iterator or calculate modifier = 
    // SUMX(
    //     ALLEXCEPT( 'FactOnlineSales' , 'FactOnlineSales'[ProductKey] )
    //     , FactOnlineSales[SalesAmount]
    // )
    SUMX(
        'FactOnlineSales'
        , CALCULATE( 
            SUM('FactOnlineSales'[SalesAmount] )
            ,  ALLEXCEPT( 'FactOnlineSales' , 'FactOnlineSales'[ProductKey] )
        )
    )

    the top one (commented) immediately raises the "... visual has exceeded the available resources" issue.

    The bottom version looks similar and retrurns a result.

     

    Depending on the size of the fact table (I consider your table 'bySO' a fact table), the version at the top errors out immediately. It's very difficult to find a size of a table where this works, for this reason I recommend rewriting this part.

     

    Hopefully, this provides some insights and will help to tackle your challenge.

     

    Regards,

    Tom