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 in Calculate filter argument

Hello Team,

 

Today I have encountered strange issue that I can't understand.

I have an AAS model where I created a measure:

CALCULATE('Measures Table'[Spend],SELECTEDVALUE(Company[txt_country])='Supplier Country'[txt_country])

and it is working fine

 

Now I switched the model to SSAS where the model and the underlying dataset is exactly the same as in this AAS

Everything in this SSAS model is working the same as in AAS, except that measure which is throwing a error that "SELECTEDVALUE has been used in a True/False expression..."

 

I found out that when I apply this measure with FILTER function it is working fine:

CALCULATE('Measures Table'[Spend],FILTER('Supplier Country',SELECTEDVALUE(Company[txt_country])='Supplier Country'[txt_country]))

 

1. Any reason why is that differs between those, basically the same, 2 models?

2. I always thought that the second argument in CALCULATE function is the exact equvalent of FILTER function, so why do I need to actually put FILTER function so it could work here?

 

Best

1 ACCEPTED SOLUTION
vapid128
Solution Specialist
Solution Specialist

https://docs.microsoft.com/en-us/dax/calculate-function-dax

 

A Boolean expression filter is an expression that evaluates to TRUE or FALSE. There are several rules that they must abide by:

  • They can reference columns from a single table.
  • They cannot reference measures.
  • They cannot use a nested CALCULATE function.

Beginning with the September 2021 release of Power BI Desktop, the following also apply:

  • They cannot use functions that scan or return a table unless they are passed as arguments to aggregation functions.
  • They can contain an aggregation function that returns a scalar value. For example,
    DAXCopy
     
    Total sales on the last selected date =
    CALCULATE (
        SUM ( Sales[Sales Amount] ),
        'Sales'[OrderDateKey] = MAX ( 'Sales'[OrderDateKey] )
    )

     

 

That means

CALCULATE('Measures Table'[Spend],SELECTEDVALUE(Company[txt_country])='Supplier Country'[txt_country])

works fine because of the update.

 

SSAS have not get the update yet.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Okay, that make sense now.

Thank you!

vapid128
Solution Specialist
Solution Specialist

https://docs.microsoft.com/en-us/dax/calculate-function-dax

 

A Boolean expression filter is an expression that evaluates to TRUE or FALSE. There are several rules that they must abide by:

  • They can reference columns from a single table.
  • They cannot reference measures.
  • They cannot use a nested CALCULATE function.

Beginning with the September 2021 release of Power BI Desktop, the following also apply:

  • They cannot use functions that scan or return a table unless they are passed as arguments to aggregation functions.
  • They can contain an aggregation function that returns a scalar value. For example,
    DAXCopy
     
    Total sales on the last selected date =
    CALCULATE (
        SUM ( Sales[Sales Amount] ),
        'Sales'[OrderDateKey] = MAX ( 'Sales'[OrderDateKey] )
    )

     

 

That means

CALCULATE('Measures Table'[Spend],SELECTEDVALUE(Company[txt_country])='Supplier Country'[txt_country])

works fine because of the update.

 

SSAS have not get the update yet.

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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