Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I'm calculating the average cost per unit that a SPECIFIC EMPLOYEE pays for a raw material over time and want to compare that to the company-wide average over time. I put the employee name in as a filter. However, if I use the analytics average (or even create a measure), this give me the average over time for that employee. How can I plot both the average unit cost for an employee over time against the average unit cost for the company over time?
Here is a picture of what I have:
My purchases table has the date, the material purchased (e.g. Colbat), the employee who purchased the material, total purchase amount, total quantity, and average unit cost (this is a measure calculated by taking total purchases divided by total quantity).
I have a filter for the specific employee and the specific material (Tom Larson and Colbat in this made-up example). I want to show the average cost for that material for ALL employees over time and not just the employee I filtered for the chart.
At this point, all I can think of is building a matrix to get my company-wide averages over time for each of my 9 raw materials and then creating a new table with that information in it and plotting it as a combo graph. Any other thoughts?
Solved! Go to Solution.
You can define constant line(s) in the Analytics pane and use measures to set the value of where to place the line.
So you can define a measure that gives the company average and a measure that gives the employee average.
To get the company average use ALL in your measure to remove the employee filter context. E.g.
CompanyAvg = CALCULATE ( AVERAGE ( Table1[Cost] ), ALL ( Table1[Employee] ) )
You can define constant line(s) in the Analytics pane and use measures to set the value of where to place the line.
So you can define a measure that gives the company average and a measure that gives the employee average.
To get the company average use ALL in your measure to remove the employee filter context. E.g.
CompanyAvg = CALCULATE ( AVERAGE ( Table1[Cost] ), ALL ( Table1[Employee] ) )
Okay -- I played around with this a bit more including researching the "ALL" statement you mentioned. This is what I wrote and it now works to give me the average from all employees regardless of what employee filter I put in the graph (YEAH!).
I put that in as follows:
Hi,
Share the link from where i can download your PBI file and show the expected result in a simple table format.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
105 | |
98 | |
39 | |
30 |