Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

IF function does not recognize columns

Hello all,

 

I'm getting in trouble with a simple IF function. I'm new to powerbi and I was not able to find a answer in previous questions in the forum. My fuction is:

 

Status = if(tGetTasks[Dashboard Grid]>1, if(tGetTasks[Actual End]>tGetTasks[DueDate]+1, "Completed - Late", "Completed - On Time"))

 

The point is that the IF function does not recognize any of my collumns from the table "tGetTasks". It is recognizing only calculated functions inside it.

 

What is weird is that I have copied this IF fuction from another powerbi file and it is working perfectly there. I have also checked and the column name is right in my table.

 

I really appreciate any support.

 

Thank you,

 

Tiago Cirilo

 

 

 

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @Anonymous  , 

 

I assume that the reason for this unexpected behavior is just this:

You are creating a new measure. A measure can be considered as an aggregation of a numeric value from a filtered table. For this reason the reference of a column inside a table has to be wrapped into an aggregation function like SUM(...).

On the other hand the creation of a calculated column allows to reference a column without using an aggregation function as the formula is evaluated for each row of the table. A more technical phrase will be: the formula of a calculated column will be evaluated inside the Row Context.

 

I guess what happened is this, you copied the DAX code from a calculated column and by accident tried to use it inside a measure definition.

 

Another hint, the term "calculated functions" is not common in the world of DAX, please try to discover what it is called that you are referencing to avoid confusio 🙂

 

Hopefully this provides some additional insights.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

1 REPLY 1
TomMartens
Super User
Super User

Hey @Anonymous  , 

 

I assume that the reason for this unexpected behavior is just this:

You are creating a new measure. A measure can be considered as an aggregation of a numeric value from a filtered table. For this reason the reference of a column inside a table has to be wrapped into an aggregation function like SUM(...).

On the other hand the creation of a calculated column allows to reference a column without using an aggregation function as the formula is evaluated for each row of the table. A more technical phrase will be: the formula of a calculated column will be evaluated inside the Row Context.

 

I guess what happened is this, you copied the DAX code from a calculated column and by accident tried to use it inside a measure definition.

 

Another hint, the term "calculated functions" is not common in the world of DAX, please try to discover what it is called that you are referencing to avoid confusio 🙂

 

Hopefully this provides some additional insights.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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