Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Cannot Convert value of type text to type True/False

Hi, 

 

I am getting below error message when I use the measure,

"Cannot Convert value of type text to type True/False"

 

I have 2 calculated fields, 1 New column and 1 new measure as below

New Column:
Volume_Cal = IF(TRIM('Orders'[DOCUMENTID])="Not MVI",'Orders'[ACCOUNTID],'Orders'[DOCUMENTID]) 

Data Type: Text


New Measure:
Volume = CALCULATE(DISTINCTCOUNT('Orders'[Volume_Cal]),FILTER('Orders','Orders'[PROCESS] in {"Posted","Credit", "Open Items"} && ('Orders'[DOCUMENTTYPE] = "AB" || (TRIM(NOT('Orders'[DOCUMENTSTATUS])) in {"Ready Validation", "Not MVI"} || ISBLANK(TRIM('Orders'[DOCUMENTSTATUS]))) && 'Orders'[Open Status] ="In Process")))

Data Type: Whole Number

 

The column value looks good, but the measure value is throwing an error as mentioned.

Similar kind of calculations I have used before but I never get such error.

 

Can anayone help me in resolving this issue.

A quick help would be much appreciated.

 

  • Hi Anonymous 

     

    I think it may be the position of your NOT function which is causing the problem.
    Try this instead (not tested):

    Volume =
    CALCULATE(
        DISTINCTCOUNT( 'Orders'[Volume_Cal] ),
        FILTER(
            'Orders',
            'Orders'[PROCESS] IN { "Posted", "Credit", "Open Items" }
                && (
                    'Orders'[DOCUMENTTYPE] = "AB"
                        || (
                            NOT ( TRIM( 'Orders'[DOCUMENTSTATUS] ) IN { "Ready Validation", "Not MVI" } )
                                || ISBLANK( TRIM( 'Orders'[DOCUMENTSTATUS] ) )
                        )
                            && 'Orders'[Open Status] = "In Process"
                )
        )
    )

     

    Best regards,
    Martyn


    If I answered your question, please help others by accepting it as a solution.

  • I doubt the position of not, check and  try

    Volume = CALCULATE(DISTINCTCOUNT('Orders'[Volume_Cal])
    ,FILTER('Orders',
    		'Orders'[PROCESS] in {"Posted","Credit", "Open Items"} 
    			&& ('Orders'[DOCUMENTTYPE] = "AB" 
    			|| (NOT(TRIM(('Orders'[DOCUMENTSTATUS])) in {"Ready Validation", "Not MVI"} )
    			|| ISBLANK(TRIM('Orders'[DOCUMENTSTATUS]))) 
    			&& 'Orders'[Open Status] ="In Process")))

    Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
    Thanks. My Recent Blog -
    Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
    Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

    Connect on Linkedin

3 Replies

  • Hi Anonymous 

     

    I think it may be the position of your NOT function which is causing the problem.
    Try this instead (not tested):

    Volume =
    CALCULATE(
        DISTINCTCOUNT( 'Orders'[Volume_Cal] ),
        FILTER(
            'Orders',
            'Orders'[PROCESS] IN { "Posted", "Credit", "Open Items" }
                && (
                    'Orders'[DOCUMENTTYPE] = "AB"
                        || (
                            NOT ( TRIM( 'Orders'[DOCUMENTSTATUS] ) IN { "Ready Validation", "Not MVI" } )
                                || ISBLANK( TRIM( 'Orders'[DOCUMENTSTATUS] ) )
                        )
                            && 'Orders'[Open Status] = "In Process"
                )
        )
    )

     

    Best regards,
    Martyn


    If I answered your question, please help others by accepting it as a solution.

    • Anonymous's avatar
      Anonymous
      Not applicable

      MartynRamsden 

      Thanks a lot.

      You are correct. "NOT" function is causing the issue.

      Now I have changed it to NOT(TRIM( 'ORDERS' [DOCUMENTSTATUS])).

  • I doubt the position of not, check and  try

    Volume = CALCULATE(DISTINCTCOUNT('Orders'[Volume_Cal])
    ,FILTER('Orders',
    		'Orders'[PROCESS] in {"Posted","Credit", "Open Items"} 
    			&& ('Orders'[DOCUMENTTYPE] = "AB" 
    			|| (NOT(TRIM(('Orders'[DOCUMENTSTATUS])) in {"Ready Validation", "Not MVI"} )
    			|| ISBLANK(TRIM('Orders'[DOCUMENTSTATUS]))) 
    			&& 'Orders'[Open Status] ="In Process")))

    Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
    Thanks. My Recent Blog -
    Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
    Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

    Connect on Linkedin