Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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.

 

2 ACCEPTED SOLUTIONS
MartynRamsden
Solution Sage
Solution Sage

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.

View solution in original post

amitchandak
Super User
Super User

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

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

MartynRamsden
Solution Sage
Solution Sage

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
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])).

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.