Forum Discussion

Dorfi's avatar
Dorfi
Regular Visitor
3 years ago
Solved

Expression.Error: We cannot apply field access to the type Function.

Hi, In trying to add a custom column in the query editor, an error is displayed.

The dispayed Error is: Expression.Error. We cannot apply field access to the type Function

Details:

Value = [Function]

Key = Amount in Company currency

I want to create a new column that shows the percentage Value of each rows currency Value. I am trying to create a formula like this one:

=[Amount in Company currency]/ List.Sum[Amount in Company currency]/1

When I insert the Total of "Amount in Company currency" Column (example 300.000$)

= [Amount in Company currency]/ 300.000$/1, the formula works.

Unfortunatly I need a working formula that works flexible (if new Values would be added to the Column).

 Thanks for the help (if possible)

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Dorfi ,

    To create the custom column you're looking for, you can use the following formula:

    =[Amount in Company currency] / List.Sum([Amount in Company currency]) * 100

    This formula divides the "Amount in Company currency" column by the sum of the column, and then multiplies the result by 100 to get the percentage value. The List.Sum function is used to calculate the sum of the column. Make sure that the "Amount in Company currency" column is a numeric data type, otherwise the formula won't work. Also, make sure that you're creating the custom column in the correct table in the query editor.

     

    Please refer to the document.

    Dealing with errors - Power Query | Microsoft Learn

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Dorfi ,

    To create the custom column you're looking for, you can use the following formula:

    =[Amount in Company currency] / List.Sum([Amount in Company currency]) * 100

    This formula divides the "Amount in Company currency" column by the sum of the column, and then multiplies the result by 100 to get the percentage value. The List.Sum function is used to calculate the sum of the column. Make sure that the "Amount in Company currency" column is a numeric data type, otherwise the formula won't work. Also, make sure that you're creating the custom column in the correct table in the query editor.

     

    Please refer to the document.

    Dealing with errors - Power Query | Microsoft Learn

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.