Forum Discussion

A454A's avatar
A454A
Frequent Visitor
30 days ago
Solved

Report failure at random schedules

 

Getting this error in few of the scheduled refreshes for a report, while just refreshing the report again fixes the issue.

 

 

 

 

Resfresh history is giving the below error.

Error fetching data for this visual : MdxScript(Model) (5, 16) Calculation error in measure '<oii>DAX Measures</oii>'[<oii>LY MTD Collection </oii>]: An argument of function 'DATE' has the wrong data type or the result is too large or too small.

 

 

Here's the measure value 

LY MTD Collection =
 
VAR _BusinessDate = [Business_Date]    ( business_date is a static value )
VAR _StartOfMonth =
DATE(YEAR(_BusinessDate) - 1, MONTH(_BusinessDate), 1)
VAR _EndDate =
DATE(YEAR(_BusinessDate) - 1, MONTH(_BusinessDate), DAY(_BusinessDate))
VAR Result =
CALCULATE(
DIVIDE(SUM('FactTable'[Amount]), 10000000),
'FactTable'[TransactionDate] >= _StartOfMonth,
'FactTable'[TransactionDate] <= _EndDate,
'FactTable'[TransactionType] <> "ExcludedType" )
 
Not understanding why the refreshes works at certain times  but fails at random times( for the same measure)

 

  • Hi A454A​,

    The detailed error suggests this is coming from the DAX measure rather than the refresh schedule itself.

    Both _StartOfMonth and _EndDate pass [Business_Date] into YEAR(), MONTH(), DAY() and DATE(). If [Business_Date] evaluates to blank, text, or an invalid date in a particular filter context, DATE() can produce the exact error you are seeing.

    I would first test the value and data type returned by [Business_Date] in the failing context. Even if it normally appears static, it is still a measure and can evaluate differently depending on filters or the state of the model immediately after refresh.

    I would also simplify the previous-year calculation by shifting the date back twelve months with EDATE, then deriving the start of that month:

    LY MTD Collection = VAR BusinessDate = [Business_Date] VAR EndDate =     IF (         NOT ISBLANK ( BusinessDate ),         EDATE ( BusinessDate, -12 )     ) VAR StartOfMonth =     IF (         NOT ISBLANK ( EndDate ),         DATE ( YEAR ( EndDate ), MONTH ( EndDate ), 1 )     ) RETURN     IF (         ISBLANK ( BusinessDate ),         BLANK (),         CALCULATE (             DIVIDE ( SUM ( 'FactTable'[Amount] ), 10000000 ),             'FactTable'[TransactionDate] >= StartOfMonth,             'FactTable'[TransactionDate] <= EndDate,             'FactTable'[TransactionType] <> "ExcludedType"         )     )

    Microsoft documents EDATE as the function for returning a date a specified number of months before or after another date. This also handles month-end cases more safely than reconstructing the prior-year date manually.

    I would additionally confirm that:

    • [Business_Date] returns a true Date/DateTime value rather than formatted text.
    • 'FactTable'[TransactionDate] is typed as Date or DateTime.
    • [Business_Date] never returns an error or multiple-value result.
    • The measure is not using FORMAT() internally, because that would convert the date to text.
    • A card visual containing only [Business_Date] still works immediately after the scheduled refresh.

    If [Business_Date] is genuinely a fixed business date, I would consider storing it in a one-row configuration table or deriving it from a proper calendar table rather than relying on a measure whose evaluation context may change.

    I hope this helps narrow it down. The “capacity or licence” banner appears to be only the visual’s generic failure message; the underlying refresh-history error is specifically identifying the date calculation.

    AI-assisted drafting: AI was used to help structure and phrase this response. I reviewed and validated the technical content before posting.

4 Replies

  • Hi A454A 

     

    I would also recommend just making sure that your measure is doing what you expected, because it looks like it could also be potentially consuming a lot of memory due to the way that the measure is written.

  • v-kathullac's avatar
    v-kathullac
    Community Support

    Thankyou GilbertQ , ShivekMaharaj   for Addressing the issue.

     

    Hi A454A  ,

     

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

     

    Regards,

    Chaithanya

  • v-kathullac's avatar
    v-kathullac
    Community Support

    Hi @A454A  ,

     

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

     

    Regards,

    Chaithanya

  • ShivekMaharaj's avatar
    ShivekMaharaj
    Power Participant

    Hi A454A​,

    The detailed error suggests this is coming from the DAX measure rather than the refresh schedule itself.

    Both _StartOfMonth and _EndDate pass [Business_Date] into YEAR(), MONTH(), DAY() and DATE(). If [Business_Date] evaluates to blank, text, or an invalid date in a particular filter context, DATE() can produce the exact error you are seeing.

    I would first test the value and data type returned by [Business_Date] in the failing context. Even if it normally appears static, it is still a measure and can evaluate differently depending on filters or the state of the model immediately after refresh.

    I would also simplify the previous-year calculation by shifting the date back twelve months with EDATE, then deriving the start of that month:

    LY MTD Collection = VAR BusinessDate = [Business_Date] VAR EndDate =     IF (         NOT ISBLANK ( BusinessDate ),         EDATE ( BusinessDate, -12 )     ) VAR StartOfMonth =     IF (         NOT ISBLANK ( EndDate ),         DATE ( YEAR ( EndDate ), MONTH ( EndDate ), 1 )     ) RETURN     IF (         ISBLANK ( BusinessDate ),         BLANK (),         CALCULATE (             DIVIDE ( SUM ( 'FactTable'[Amount] ), 10000000 ),             'FactTable'[TransactionDate] >= StartOfMonth,             'FactTable'[TransactionDate] <= EndDate,             'FactTable'[TransactionType] <> "ExcludedType"         )     )

    Microsoft documents EDATE as the function for returning a date a specified number of months before or after another date. This also handles month-end cases more safely than reconstructing the prior-year date manually.

    I would additionally confirm that:

    • [Business_Date] returns a true Date/DateTime value rather than formatted text.
    • 'FactTable'[TransactionDate] is typed as Date or DateTime.
    • [Business_Date] never returns an error or multiple-value result.
    • The measure is not using FORMAT() internally, because that would convert the date to text.
    • A card visual containing only [Business_Date] still works immediately after the scheduled refresh.

    If [Business_Date] is genuinely a fixed business date, I would consider storing it in a one-row configuration table or deriving it from a proper calendar table rather than relying on a measure whose evaluation context may change.

    I hope this helps narrow it down. The “capacity or licence” banner appears to be only the visual’s generic failure message; the underlying refresh-history error is specifically identifying the date calculation.

    AI-assisted drafting: AI was used to help structure and phrase this response. I reviewed and validated the technical content before posting.