Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I have a large amount of data with a lot of different work centers, but I want to calculate workcenter1(good parts/total parts) * workcenter2(good parts/total parts) * ... but only for a certain list of workcenter numbers. Is there a way to create the list of work centers in DAX or do I need to create a new column with M to create that list?
This is a mishmash of the code that is working and what I would like to do with it:
array BR41 = {"670205","670206","670302","670502","670902","670904","671002","671202"};
float RolledYield = 1;
for(int i=0;i<=7;i++)
{
string LoopedWorkcenterNumber = BR41[i];
float RolledYield = RolledYield *
// DAX code I have been using for calculating the filtered yield data
DIVIDE( CALCULATE( SUM(DWS_ConfPassAndScrap[PassQuantity]),FILTER(ALL(DWS_ConfPassAndScrap[Workcenternumber]),DWS_ConfPassAndScrap[Workcenter]= LoopedWorkcenterNumber)),
CALCULATE(SUM(DWS_ConfPassAndScrap[PassQuantity]),FILTER(ALL(DWS_ConfPassAndScrap[Workcenter]),DWS_ConfPassAndScrap[Workcenter]=LoopedWorkcenterNumber))
+CALCULATE(SUM(DWS_ConfPassAndScrap[ScrapQuantity]),FILTER(ALL(DWS_ConfPassAndScrap[Workcenter]),DWS_ConfPassAndScrap[Workcenter]=LoopedWorkcenterNumber)))
}
Solved! Go to Solution.
Hi,
I would recommend using PRODUCTX function:
test data:
Here the goal is to have your logic applied for cost centers A,B and D. The result would be (1/2)*(2/2)*(1/2)
Here is the dax:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Proud to be a Super User!
Hi @Farandolai
not sire if I fully understand the requirement however please try
Measure1 =
PRODUCTX (
TREATAS (
{
"670205",
"670206",
"670302",
"670502",
"670902",
"670904",
"671002",
"671202"
},
DWS_ConfPassAndScrap[Workcenter]
),
CALCULATE (
DIVIDE (
SUM ( DWS_ConfPassAndScrap[PassQuantity] ),
SUM ( DWS_ConfPassAndScrap[PassQuantity] )
+ SUM ( DWS_ConfPassAndScrap[ScrapQuantity] )
)
)
)
Hi @Farandolai
not sire if I fully understand the requirement however please try
Measure1 =
PRODUCTX (
TREATAS (
{
"670205",
"670206",
"670302",
"670502",
"670902",
"670904",
"671002",
"671202"
},
DWS_ConfPassAndScrap[Workcenter]
),
CALCULATE (
DIVIDE (
SUM ( DWS_ConfPassAndScrap[PassQuantity] ),
SUM ( DWS_ConfPassAndScrap[PassQuantity] )
+ SUM ( DWS_ConfPassAndScrap[ScrapQuantity] )
)
)
)
Hi,
I would recommend using PRODUCTX function:
test data:
Here the goal is to have your logic applied for cost centers A,B and D. The result would be (1/2)*(2/2)*(1/2)
Here is the dax:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Proud to be a Super User!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
24 | |
21 | |
17 | |
14 | |
10 |
User | Count |
---|---|
42 | |
35 | |
25 | |
23 | |
23 |