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!

Reply
Jeanxyz
Post Prodigy
Post Prodigy

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?

 

error message.PNG

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
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.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
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
Post Prodigy
Post Prodigy

related() is used to get product category from Product Category table, earlier is used to get the product category where the current product belongs to. 

 

Here is the sample file. You can find the formula as a calculated column in product table. 

 

https://www.dropbox.com/s/ldiu167y0xxvn5g/Contoso.pbix?dl=0

amitchandak
Super User
Super User

@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.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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