Power BI Exchange

Please login or click SIGN UP FOR FREE to create your PowerBIUG account to join this user group.
Expand all | Collapse all

comparison of text to int

  • 1.  comparison of text to int

    Bronze Contributor
    Posted Aug 16, 2019 02:46 PM
    I got a calculation error in the below stating that it does not support comparing Text with Int. I don't see any comparison of text to int. Does anyone else

    ​%AllLate =
    VAR Dt = SELECTEDVALUE(AllLate[dtmReportDate]) // Getting Current Date

    VAR Ttl = CALCULATE(COUNT(AllLate[intLate]),FILTER(ALL(AllLate),AllLate[dtmReportDate]=Dt)) // Return  Total Number of Inputs for that office for particular date
    Var Cnt =CALCULATE(COUNT(AllLate[intLate]),FILTER(AllLate,AllLate[intLate]>0)) // Assuming Late flag is "1" or greater than Zero so filter out Count that are Late only

    RETURN

    IF(ISBLANK(DIVIDE(Cnt,Ttl,0)),0,DIVIDE(Cnt,Ttl,0)) // Dividing Late Count with Total Count
    //Change the Format of Measure to Percentage​))

    ------------------------------
    Alexis (Lex) Kinter
    QA Engineer / Innovation Lead
    ------------------------------


  • 2.  RE: comparison of text to int

    Top Contributor
    Posted Aug 19, 2019 04:25 AM
    Edited by Vishesh Jain Aug 19, 2019 04:26 AM
    Hi @Alexis (Lex) Kinter​,

    Please can you check the Data type of the AllLate[intLate] column and other columns that are involved in your measure.

    This problem could arise because the data type of some column in your measure is 'text' and it should be a number, decimal or fixed.

    Another problem could be the ISBLANK() function. In that, since you are using divide, it will never be blank and will give, if not anything else, then a 0.

    You might want to replace that with '=0' or something on the lines of that.

    Hope this helps.

    Thank you,

    ------------------------------
    Vishesh Jain
    Owner
    VR Construction
    ------------------------------



  • 3.  RE: comparison of text to int

    Bronze Contributor
    Posted Aug 19, 2019 04:14 PM
    Thank you! I found the datatype issue! You are very helpful.

    ------------------------------
    Alexis (Lex) Kinter
    QA Engineer / Innovation Lead
    ------------------------------