DAX Expressions New
DAX Expressions New
DAX Expressions New
net
sqldb-bi
ECCN Discrepancy =
var a = RELATED('Item_BasicInfo'[DFF ECCN])
var b = 'Item_Orginfo'[Org ECCN]
var c=RELATED(Organization[Organization Code])
var d = SWITCH(TRUE(),
(a=b)||(a<>BLANK() && b=BLANK())||(a=BLANK() && b=BLANK()),"NO",
(a=BLANK() && b<>BLANK()),"YES",
(c IN {"135","191","415"} ) && (a<>b),"NO","YES")
return d
ECCN Discrepancy =
var a = RELATED(Item_BasicInfo[DFF ECCN]
var b = Item_Orginfo[Org ECCN]
var c = if(Item_Orginfo[Organization ID]=6782,(if(a<>b,"YES"))
return c
ECCN Discrepancy =
IF(not(
Item_Orginfo[Organization ID] IN{6782,5353,66782} &&
Item_Orginfo[MST ECCN]<>Item_Orginfo[Org ECCN]), "NO",
IF((
Item_Orginfo[Organization ID] IN{6782,5353,66782} &&
Item_Orginfo[MST ECCN]<>Item_Orginfo[Org ECCN]),"YES"))
ECCN Discrepancy =
IF(not( Item_Orginfo[Organization ID] IN{6782,5353,66782} && Item_Orginfo[MST
ECCN]<>Item_Orginfo[Org ECCN]),"YES","NO")
//IF(( Item_Orginfo[Organization ID] IN{6782,5353,66782} && Item_Orginfo[MST
ECCN]<>Item_Orginfo[Org ECCN]),"NO")
Assigned to Position =
var cntPosition = CALCULATE(COUNTROWS(Control_Functions))
RETURN
IF(cntPosition>0,"Yes","No")
PO Amount Bucket =
var a = 'Purchase Order Bucket'[USD Amount]
Aging =
if(TODAY()-PurchaseOrder[PO Creation Date]< 120,"00-04 Months",
if(TODAY()-PurchaseOrder[PO Creation Date]< 180,"04-06 Months",
if(TODAY()-PurchaseOrder[PO Creation Date]< 270,"07-09 Months",
if(TODAY()-PurchaseOrder[PO Creation Date]< 365,"10-12 Months",
if(TODAY()-PurchaseOrder[PO Creation Date]<540,"1.0-1.5 Years",
if(TODAY()-PurchaseOrder[PO Creation Date]<730,"1.5-2 Years",
if(TODAY()-PurchaseOrder[PO Creation Date]< 1095,"2-3 Years","over 3
Years")))))))
Opportunity Type =
VAR rslt = SWITCH(TRUE(),
ItemInstance[Remaining Life based on IB Creation Date]<=0,"Capital
Opp.",
ISBLANK(RELATED('Latest Contract'[Contract Number])),"New Contract
Opp.",
RELATED('Latest Contract'[Header Status])="EXPIRED" &&
RELATED('Latest Contract'[Contract Service Type])="WARRANTY","Exp Warranty Cont
Opp.",
RELATED('Latest Contract'[Header Status])="EXPIRED" &&
RELATED('Latest Contract'[Contract Service Type])="SERVICE","Service Renewal Cont
Opp.",
RELATED('Latest Contract'[Contract Service Type])="WARRANTY", "New
Contract Opp." ,
"Service Renewal Cont Opp."
)
RETURN
rslt
Opportunity Year =
var yr = YEAR(RELATED('Latest Contract'[End Date]))
var curYear = YEAR(TODAY())
return
SWITCH(TRUE(),
ISBLANK(yr),curYear,
MAX(yr,curYear))
Measures:
% <2 Days Invoices = DIVIDE([Entered <2 Days Past Recieved Date],[Total Invoices
With Received Dates],0)
% ≥30 Days holds = DIVIDE([≥30 Days holds],Count('Invoice Holds'[Hold Id]),0)
Aging =
if(TODAY()-PurchaseOrder[PO Creation Date]< 120,"00-04 Months",
if(TODAY()-PurchaseOrder[PO Creation Date]< 180,"04-06 Months",
if(TODAY()-PurchaseOrder[PO Creation Date]< 270,"07-09 Months",
if(TODAY()-PurchaseOrder[PO Creation Date]< 365,"10-12 Months",
if(TODAY()-PurchaseOrder[PO Creation Date]<540,"1.0-1.5 Years",
if(TODAY()-PurchaseOrder[PO Creation Date]<730,"1.5-2 Years",
if(TODAY()-PurchaseOrder[PO Creation Date]< 1095,"2-3 Years","over 3
Years")))))))
var b = if(PurchaseOrder[Currency]="USD",1,a)
return b
PO Amount Bucket =
var a = 'Purchase Order Bucket'[USD Amount]
return b
Hold Aging = if ([Days On Hold] <= 30, "0-30 Days" , if ([Days On Hold] <= 60 ,
"31-60 Days" , if ([Days On Hold] <= 90 , "61-90 Days" ,
if ([Days On Hold]<= 120 , "91-120 Days" , "Over 120 Days"))))
Hold Aging = if ([Days On Hold] <= 30, "0-30 Days" , if ([Days On Hold] <= 60 ,
"31-60 Days" , if ([Days On Hold] <= 90 , "61-90 Days" ,
if ([Days On Hold]<= 120 , "91-120 Days" , "Over 120 Days"))))
Assigned to Position =
var cntPosition = CALCULATE(COUNTROWS(Control_Functions))
RETURN
IF(cntPosition>0,"Yes","No")
Mansfield Equipment =
switch(true(),
JobOperationMoveTransaction[From Operation Description]="L32 LATHE"
&& JobOperationMoveTransaction[From Intra Operation Step Type]="QUEUE"
&& RELATED(Job_Assembly[Assembly]) in {"260122001"}, "lathe",
"tEST")
L32 = CALCULATE(sum(JobOperationMoveTransaction[Primary
Quantity]),filter(Job_Assembly,Job_Assembly[Assembly] in
{"260122001","260122003"}),filter(JobOperationMoveTransaction,JobOperationMoveTrans
action[From Operation Description]="L32
LATHE"),FILTER(JobOperationMoveTransaction,JobOperationMoveTransaction[From Intra
Operation Step Type]="QUEUE"))
PM
MEASURE
Latest Completion Date = MAX('Preventive_WO'[Completion Date])
column
Last PM Date = CALCULATE(MAX('Preventive_WO'[Completion Date]))
Next PM Date = CALCULATE(MIN('Preventive_WO'[Scheduled Completion
Date]),'Preventive_WO'[Status]="Released")
Active? = IF((ISBLANK('Asset'[Activity End Date]) && NOT(ISBLANK('Asset'[Activity
Start Date]))), "Yes",IF(ISBLANK('Asset'[Activity End Date]),"Unknown","No"))
Active? = IF((ISBLANK('PM Schedule'[To Effective Date])&&NOT(ISBLANK('PM
Schedule'[From Effective Date]))), "Yes",IF(ISBLANK('PM Schedule'[From Effective
Date]),"Unknown","No"))
Shutdown Leadtime (MTTR) = DATEDIFF('Preventive_WO'[Shutdown End
Date],'Preventive_WO'[Actual Start Date],DAY)
Technician =
VAR wip_entity_id = 'Preventive_WO'[WIP Entity ID]
RETURN
CALCULATE(MAX('Operations'[User Name]), FILTER('Operations', 'Operations'[WIP
Entity ID] = wip_entity_id))
Inspection Due =
switch(true(),
'Preventive WO'[Work Order Number] <>BLANK()
&& 'Preventive WO'[Status]="Released" , "Yes","No")
Inspection Due =
switch(true(),
Preventive_WO[Work Order Number] <>BLANK() &&
Preventive_WO[Status]="Released" && ISBLANK('PM Schedule'[To Effective Date])))
Active? = IF(
(
ISBLANK('Asset'[Activity End Date])
&&
NOT(
ISBLANK('Asset'[Activity Start Date])
)), "Yes",IF(ISBLANK('Asset'[Activity End Date]),"Unknown","No"))
Active1? = IF(
(
ISBLANK(Preventive_WO[Work Order Number])
&&
NOT(
ISBLANK(Filter(QA_Discrepancy,QA_Discrepancy[Work_Order])
))
&& Preventive_WO[Status]="Released"),"Yes","No"))
Due? =
var a = Preventive_WO[Status]
var b =Preventive_WO[Work Order Number]
var c = Filter(QA_Discrepancy,QA_Discrepancy[Work_Order])
var d = if(a="Released" && c = BLANK()), "YES","NO"
Return d