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
Tommyvhod
Helper II
Helper II

average of production time for 1 ID

Hi all

 

I would like to create a Dax formula for average production time for a product. I have different working stations and for 1 product 1 name and for one piece unique IDs. I would like to add a slicer as well for the finish time of the part.

 

So I would like to filter out IDs which has the first and last working stations not blank ( so it is completely went trought the production) and from that sum of production time create an average.

 

so. eg I have 4 working stations and I would like to filter out IDs which contains the first and fourth Working stations.

 

Working stationitemIDtime
1p1120,1
1o1130,5
1l1140,3
1o1150,5
2p1120,3
2o1150,5
2l1140,3
3p1120,3
3o1150,5
4o1150,5

 

In this case item o with ID 115 is completely finished because operation 1 and 4 is finished. I would like to sum up the production time ( in this case 4 x 0.5) for all finished parts and create an average for item o ( of course I have more pcs in production from one item )

 

The trick just to make it more complicated; I would like to filter the amounts in time ranges. I used to filter out last 5 weeks production but the full production time can be longer than 5 weeks. So I would like to filter last work station by time but leave the full process time from the beginning.(I have another column for dates as well for each working station.)

 

The formula should find all finished item ( sliced with last operation date ) filter out items which do not contain operation 1 and 4 ( but of course work station 1 can be a year before works station 4 but i need the full production time from the beginning.) sum up one IDs prouction time and average it for one item. I hope you guys understand what is my goal

 

I tried multiple approaches but this is way over my knowledge. Any help is appreciated

 

Thank you

 

 

 

 

2 REPLIES 2
JustJan
Responsive Resident
Responsive Resident

Hi @Tommyvhod ,

 

If I understood your question you can do the following: 

 

( I have added a ProductionDate to you data table)
2020-02-09 15_07_36-Window.png

 

So only the last 5 weeks are selected.


2020-02-09 15_13_46-Window.png

The measure first finds the ID where the Workstation = 1 and 4 and then calculates the production time.

 

WS 1&4 Production Time = 
IF (
CALCULATE(
SUMX( Production, IF (Production[Working station] = 1 || Production[Working station] = 4, 1)),
All(Production[ProdDate])
) = 2,
CALCULATE (
sum(Production[time]), -- change sum to average for the average production time
All(Production[ProdDate])
)
)

Hope you this helps

 

Jan 

I added the formula but I receive a blank result. I tried work station as a value but stil nothing

 

sum of act = IF(
CALCULATE(
SUMX(Data;IF(Data[Operacia] = VALUE(30)|| Data[Operacia] = VALUE(410);1));
ALL(Data[Datum transakcie]))=2;
CALCULATE(
SUM(Data[Act time]);ALL(Data[Datum transakcie])))
 
(The operacia is the working station,i have 70 work stations starting with number 30 and ending 410; datum is date
 
I dont understatnd the =2 marked with red, whgat that does meant to say? ( I am not a dax expert )

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.

Top Solution Authors