Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Need help with measure

Hi there!

 

I´m trying to get this calculation done:

 

Tons/Number of FTE

 

I have these tables:

 

Table1: Tons

Line|Month|Tons

 

Table2: Base

ID number|Month worked

 

What I need is to graph by month, the sum of al the tons produced divided by the total of FTE that worked in each month.

 

I came up with this measure:

 

Tn/FTE = divide( sum(Tons[Tons]), DISTINCTCOUNT(Base[ID]))
 
The issue here is that if i apply a filter to the graph, values will change acording to the number of FTE who worked in the filtered month, the math will do is Jan´s Tons/# filtered month ; Feb's Tons/#filetred month...
 
How can i solve this issue?
 
Thanks in advance!

4 Replies

  • Anonymous As a best practice, add date dimension in your model and use it for and time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools.

    https://perytus.com/2020/05/22/create-a-basic-date-table-in-your-data-model-for-time-intelligence-calculations/

     

    Connect this table with both of your tables and then use column from this table in your visual and everything will work as expected.

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos 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.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks! I have these tables:

      Thanks in advance!

       
       
       
      Table1: "Tons"
      Production LineMonthTons
      Line 1Jan-2029
      Line 2Jan-2015
      Line 3Jan-2025
      Line 1feb-2028
      Line 2feb-2030
      Line 3feb-2013
      Line 1mar-2014
      Line 2mar-2010
      Line 3mar-2019
      Table2: "Base"
      ID NumberMonth
      4667Jan-20
      4667feb-20
      4667mar-20
      4843feb-20
      4843mar-20
      8616Jan-20
      8616feb-20
      2224feb-20
      4360Jan-20
      4360feb-20
      4360mar-20
      1312Jan-20
      1312mar-20
      1527Jan-20
      1527feb-20
      1527mar-20
      3288Jan-20
      3288feb-20
      3288mar-20
      3706feb-20
      3094mar-20
      3094feb-20
      3094mar-20
       Total TonsTotal PeopleExpected Output 
      Jan-2069611,5= 69/6
      feb-207197,9= 71/9
      mar-204385,4= 43/8