Forum Discussion

Pallavi_m's avatar
Pallavi_m
Icon for Helper I rankHelper I
3 years ago
Solved

DAX not identifying the column names

Hi,

When I'm writing a measure, it prompts CANNOT FIND NAME[COLUMN NAME].

 

For ex: If( 'category'[oil]='yes' ,'code1','code2')

 

the column ('category'[oil]) in above dax works for the previously written measures, but now when I want to use the same column and write another measure. It's prompting "CANNOT FIND NAME[COLUMN NAME]"

This is happening with other columns and tables too.

Why is this suddenly happening?

Please help me.

  • Pallavi_m When you reference a column in a measure, you have to use an aggregation like MAX, MIN, SUM, etc. Are you sure that you have previously created calculated columns (not measures) because with calculated columns you do not need the aggregation.

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Pallavi_m ,

    Is [forecast] a measure or one field in the table? If it is a measure, please update the formula of measure as below and check if it can return the correct result...

    MeasureName = CALCULATE ( [forecast], FILTER ( 'Region', 'Region'[country] <> BLANK () ) )

    Otherwise, please update the formula of the measure as below:

    MeasureName = CALCULATE ( SUM([forecast]), FILTER ( 'Region', 'Region'[country] <> BLANK () ) )

    If the above one can't help you get the desired result, please provide some sample data in the table 'Region' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards

6 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Pallavi_m When you reference a column in a measure, you have to use an aggregation like MAX, MIN, SUM, etc. Are you sure that you have previously created calculated columns (not measures) because with calculated columns you do not need the aggregation.

    • Pallavi_m's avatar
      Pallavi_m
      Icon for Helper I rankHelper I

      I'm trying to use a filter in calculate function, and it says CANNOT FIND NAME[COLUMN NAME]

      where I've used the same filter previously for other measure and they are working fine in the page/report.

      • FreemanZ's avatar
        FreemanZ
        Icon for Super User rankSuper User

        hi Pallavi_m 

         

        If there is row context, we can use table[col] like values. A row contex exist in calculated columns or iterators (like X-functions).

        If not, it will end an error. 

         

        Do you have a row context for this code?

        If( 'category'[oil]='yes' ,'code1','code2')

         

        You say it worked previously, can you also share the previous code?

    • carlogazzani's avatar
      carlogazzani
      Regular Visitor

      its a text column...

      if( table[textcolumn] = "A", "---")

      but this text column not recognized by dax,