Business Analytics

Expand all | Collapse all

data type issue

  • 1.  data type issue

    Posted Fri July 03, 2020 10:19 AM
    case
    when [SQL1].[MTH_OF_YR]>3 and [SQL1].[YR]=2020
    then
    [SQL1].[AVERAGE_SPEED]=''
    else
    [SQL1].[AVERAGE_SPEED]



    this is not working.i got error RSV-VAL-0010 failed to load specification.XQE-PLN-0001.Internal error.
    can anyone please let me know what is resolution.

    ------------------------------
    Priyanka Joshi
    ------------------------------


  • 2.  RE: data type issue

    Posted Fri July 03, 2020 11:55 AM
    The problem is you are mixing different data types in the "THEN" and the "ELSE"

    When you entered two single quotes for the "THEN", that is a string (text). Where as the "ELSE" is a field that I'm assuming is numeric.

    So instead of '' (two single quotes), use NULL or 0.

    Here's a syntax that worked for me...  I don't think all the parentheses (brackets) I used are not mandatory but that's my style:

    case
    when (([Sales (query)].[Time].[Year] > 2000) and ([Sales (query)].[Time].[Month number] > 6))
    then (NULL)
    else
    ( [Sales (query)].[Sales].[Quantity] )
    END

    ------------------------------
    Jason Tavoularis
    ------------------------------