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

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!
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

Try this way as below:

Step1:

Create a dim date table:

https://radacad.com/do-you-need-a-date-dimension

 

Step2:

Create the relationship as below:

5.JPG

Step3:

Create a measure

Tn/FTE = DIVIDE( SUM(Tons[Tons]), DISTINCTCOUNT(Base[ID Number]))

 

Result:

6.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

Try this way as below:

Step1:

Create a dim date table:

https://radacad.com/do-you-need-a-date-dimension

 

Step2:

Create the relationship as below:

5.JPG

Step3:

Create a measure

Tn/FTE = DIVIDE( SUM(Tons[Tons]), DISTINCTCOUNT(Base[ID Number]))

 

Result:

6.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

You need to use ALL Function in your measure

https://www.sqlbi.com/articles/managing-all-functions-in-dax-all-allselected-allnoblankrow-allexcept/

 

If not your case, please share your sample data and your expected output.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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
parry2k
Super User
Super User

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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.