Forum Discussion

answeriver's avatar
answeriver
Icon for Helper IV rankHelper IV
4 years ago
Solved

Error cannot convert value of type text to type true false

hello all, Can yo please explain logic of error.   Measure is: = CALCULATE(DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]))/CALCULATE(DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]),ALLEXCEPT(REPORT_IMS,'RE...
  • Pragati11's avatar
    4 years ago

    HI answeriver ,

     

    • First thing is try to use DIVIDE dax function to do your calculation.
    • Break-down your measure to variables
    • I think the sytax error is on your ALLEXCEPT function. You have closed the bracket for this function too early.

    Your syntax error is somehwere in this part of DAX:

    ALLEXCEPT(
                       REPORT_IMS, 'REPORT_IMS'[CITY], REPORT_IMS[REGION (groups)], REPORT_IMS[VISIT MONTH]
                     ), // you have closed the ALLEXCEPT clause here

    REPORT_IMS[VISIT YEAR],'Attributes','Attributes'[type contract] // this is the line with error I guess

     

    Question for you: What you are trying to achieve here with the line of code above?

     

    You will have to correct your DAX something like this:

    = CALCULATE(
                DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE])
               )
    /
    CALCULATE(
              DISTINCTCOUNT(REPORT_IMS[SALEPOINT CODE]), 
              ALLEXCEPT( 
                        REPORT_IMS, 'REPORT_IMS'[CITY], REPORT_IMS[REGION (groups)], 
                        REPORT_IMS[VISIT MONTH], REPORT_IMS[VISIT YEAR]
                       ), 
             ALLEXCEPT(
                       'Attributes','Attributes'[type contract]
                      )
            )

     

    Check if the above DAX works. Make sure to write your DAX as clean as possible - specially the closing and opening brackets.