Forum Discussion

Jeanxyz's avatar
Jeanxyz
Power Participant
4 years ago
Solved

error message while the formula still works

I got a small question on the warning over a calculation formula. The formula itself seems to work, it gives me the correct output, however, part of the formula is highlighted. When I hoover over the highlighted part, it says "Parameter is not the correct type". What does that mean?

 

  • Hi Jeanxyz 

     

    You could refer to RELATED function (DAX) and EARLIER function (DAX). In EARLIER function, the first parameter is expected to be A column or expression that resolves to a column. While the return value of RELATED function is A single value that is related to the current row. Usually a single value is not a column, so it detects the syntax error. 

     

    In your case, you could try below code for a calculated column in product table.

    total profit per category = CALCULATE(SUM('Product'[Profit]),ALLEXCEPT('Product Category','Product Category'[Category]))

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

3 Replies

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi Jeanxyz 

     

    You could refer to RELATED function (DAX) and EARLIER function (DAX). In EARLIER function, the first parameter is expected to be A column or expression that resolves to a column. While the return value of RELATED function is A single value that is related to the current row. Usually a single value is not a column, so it detects the syntax error. 

     

    In your case, you could try below code for a calculated column in product table.

    total profit per category = CALCULATE(SUM('Product'[Profit]),ALLEXCEPT('Product Category','Product Category'[Category]))

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

  • Jeanxyz , earlier will not take another function.

    Why do you need earlier and related together?

     

    First, create a column using earlier in the product table and move it to another using related.