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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

0

Calculation Error in Measure

Greetings Community Members:

 

I am new learner. I was applying the Table Expression Filter CALCULATE DAX Function with FILTER DAX inside it as under:

 

Country Wise Sales = CALCULATE('Sales'[Total Sales],FILTER('Sales Territory', 'Sales Territory'[Country]))

MdxScript(Model)(70:93) Calculation Error in Measure

'Sales'[Country Wise Sales]:cannot convert value 'United States' of Type Text to Type True/False

 

It looks that I am at fault. However, I am not getting clear about the error and can't resolve the error. 

 

Kindly help in this regard. 

 

 

The Screen Shot is attached hereunder:

 

RehanSheikh_0-1658601035340.png

 

Yours truly,

 

Rehan Sheikh

Status: Delivered

Hi @RehanSheikh,

 

According to the error message, you are using a Text fields as the argument of FILTER function which is not allowed. According to the syntax of FILTER, the second parameter should be a Boolean expression that can be used to filter the table specified as the first parameter. FILTER function (DAX) - DAX | Microsoft Docs

 

Therefore, you need make some changes to your formula.

Country Wise Sales = CALCULATE('Sales'[Total Sales],FILTER('Sales Territory',VALUES( 'Sales Territory'[Country])))

Or

Country Wise Sales = CALCULATE('Sales'[Total Sales],FILTER('Sales Territory','Sales Territory'[Country]="United States"))

 

Best Regards,

Community Support Team _ Caiyun

Comments
v-cazheng-msft
Community Support
Status changed to: Delivered

Hi @RehanSheikh,

 

According to the error message, you are using a Text fields as the argument of FILTER function which is not allowed. According to the syntax of FILTER, the second parameter should be a Boolean expression that can be used to filter the table specified as the first parameter. FILTER function (DAX) - DAX | Microsoft Docs

 

Therefore, you need make some changes to your formula.

Country Wise Sales = CALCULATE('Sales'[Total Sales],FILTER('Sales Territory',VALUES( 'Sales Territory'[Country])))

Or

Country Wise Sales = CALCULATE('Sales'[Total Sales],FILTER('Sales Territory','Sales Territory'[Country]="United States"))

 

Best Regards,

Community Support Team _ Caiyun