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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Error+Message%3A+MdxScript(Model)+(7%2C+138)+Calculation+error+in+measure

I need urgent help. I am  new user who is struggling with an error message shown below:

 

Error+Message%3A+MdxScript(Model)+(7%2C+138)+Calculation+error+in+measure

 

This comes when i write a calculate measure with a filter that is TRUE/FALSE type. 

 

Can someone rescue me? Below is the measure;

 

Prog Stock value(Expired & Closed) = ( SUMX( FILTER('Current Stock Report','Current Stock Report'[SOF Status]="SOF Closed"||'Current Stock Report'[SOF Status]="SOF Expired"||'Current Stock Report'[Prog / Admin Stock]="False"), ('Current Stock Report'[TIM Stock Value ($)]) ))

1 ACCEPTED SOLUTION
Anonymous
Not applicable

[TIM Stock Value] =
	CALCULATE(
		SUM ( 'Current Stock Report'[TIM Stock Value ($)] ),
		'Current Stock Report'[Prog / Admin Stock] -- this only keeps the TRUE values visible
	)

Best

D.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

[Prog Stock Value (Expired & Closed)] =
    SUMX (
        FILTER (
            'Current Stock Report',
            
            'Current Stock Report'[SOF Status] = "SOF Closed"
                || 'Current Stock Report'[SOF Status] = "SOF Expired"
                || NOT ( 'Current Stock Report'[Prog / Admin Stock] )
        ),
        'Current Stock Report'[TIM Stock Value ($)]
    )

You cannot mix data types. If something is logical (False) you cannot equate it to a string ("False").

 

Best

Darek

Anonymous
Not applicable

Thank you Darek. 

Then I need your suggestion. For below, I need to calculate the sum of TIM stock Value 

'Current Stock Report'[TIM Stock Value ($)]

but only filter out what is 'False' in

( 'Current Stock Report'[Prog / Admin Stock] 

 The later is a true False data type.

Any suggestion?

Anonymous
Not applicable

[TIM Stock Value] =
	CALCULATE(
		SUM ( 'Current Stock Report'[TIM Stock Value ($)] ),
		'Current Stock Report'[Prog / Admin Stock] -- this only keeps the TRUE values visible
	)

Best

D.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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