cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mikeborg82 Regular Visitor
Regular Visitor

DAX help

I am trying to create a new measure based on two other columns.  I want to create a column that tells me the average increase of salaries... I have both before and after.  When I create the DAX column I cannot seem to get any fields from that table into the formula.  I have tried closing, refreshing, etc... Any ideas of what I can do. This is the first time Ive had this happen.

 

Thanks.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: DAX help

Try using RELATED or RELATEDTABLE


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


v-ljerr-msft Super Contributor
Super Contributor

Re: DAX help

Hi @mikeborg82,

Remarks
The RELATED function requires that a relationship exists between the current table and the table with related information. You specify the column that contains the data that you want, and the function follows an existing many-to-one relationship to fetch the value from the specified column in the related table. If a relationship does not exist, you must create a relationship.

When the RELATED function performs a lookup, it examines all values in the specified table regardless of any filters that may have been applied.

System_CAPS_ICON_note.jpg Note


The RELATED function needs a row context; therefore, it can only be used in calculated column expression, where the current row context is unambiguous, or as a nested function in an expression that uses a table scanning function. A table scanning function, such as SUMX, gets the value of the current row value and then scans another table for instances of that value.



For more details about RELATED and RELATEDTABLE function, you can refer to the following two articles. Smiley Happy

https://msdn.microsoft.com/en-us/library/ee634202.aspx

https://msdn.microsoft.com/en-us/library/ee634226.aspx

 

Regards

4 REPLIES 4
Super User
Super User

Re: DAX help

Try using RELATED or RELATEDTABLE


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


mikeborg82 Regular Visitor
Regular Visitor

Re: DAX help

That works.  Thanks for your help.  Can you explain what it was doing?  I am pretty new to powerbi.

 

 

Super User
Super User

Re: DAX help

Typically when creating DAX custom column is that the context is constrained to the table that you are in. To change context, one can use things like RELATED and RELATEDTABLE to change the context in which the DAX operates.


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


v-ljerr-msft Super Contributor
Super Contributor

Re: DAX help

Hi @mikeborg82,

Remarks
The RELATED function requires that a relationship exists between the current table and the table with related information. You specify the column that contains the data that you want, and the function follows an existing many-to-one relationship to fetch the value from the specified column in the related table. If a relationship does not exist, you must create a relationship.

When the RELATED function performs a lookup, it examines all values in the specified table regardless of any filters that may have been applied.

System_CAPS_ICON_note.jpg Note


The RELATED function needs a row context; therefore, it can only be used in calculated column expression, where the current row context is unambiguous, or as a nested function in an expression that uses a table scanning function. A table scanning function, such as SUMX, gets the value of the current row value and then scans another table for instances of that value.



For more details about RELATED and RELATEDTABLE function, you can refer to the following two articles. Smiley Happy

https://msdn.microsoft.com/en-us/library/ee634202.aspx

https://msdn.microsoft.com/en-us/library/ee634226.aspx

 

Regards