Forum Discussion

amirabedhiafi's avatar
amirabedhiafi
Impactful Individual
5 years ago
Solved

Use a column from another table to create a calculated column

I have the following data model : 

I want to add a calculated column where I will have this formula :

[Total Wage By for Weekday]=([Hours]-8) * [Hourly Wage] * 1.5

This is my work :

 

The problem is[Hours] column is a table called [Time] and [Employee] and [Hourly Wage] columns are in another table called [Employees].

When I try to create the calculated column in the table [Employees], the columns [Hours] in [Time] are not reconized.

 

  • amirabedhiafi try this as a column in Time table

     

    [Total Wage By for Weekday]=(TimeTable[Hours]-8) * RELATED(EmployeeTable[Hourly Wage]) * 1.5

     

    Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

3 Replies

  • amirabedhiafi try this as a column in Time table

     

    [Total Wage By for Weekday]=(TimeTable[Hours]-8) * RELATED(EmployeeTable[Hourly Wage]) * 1.5

     

    Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • amirabedhiafi's avatar
      amirabedhiafi
      Impactful Individual

      Is it possible to add a filter to the calculated column ?

      I want to filter by the [DayType]=="Weekend" column which is in a table called [Date]

       

  • amirabedhiafi not sure why you need that, you should create a measure for your final calculation and then put the weekend filter there.