Forum Discussion
Anonymous
4 years agoNot applicable
First time right for repairs
Hello! I'm trying to write a formula for a measured column to calculate wheter or not a repair was right at the first attempt. I have a table with tickets and columns for - serialnumbers of prod...
- 4 years ago
Hi Anonymous ,
Please try:
Column = VAR _a = CALCULATE ( COUNT ( 'Table'[Serialnumber] ), FILTER ( 'Table', [Serialnumber] = EARLIER ( 'Table'[Serialnumber] ) ), DATESINPERIOD ( 'Table'[closingdate], 'Table'[closingdate], 30, DAY ) ) VAR _b = CALCULATE ( COUNT ( 'Table'[Serialnumber] ), FILTER ( 'Table', [Serialnumber] = EARLIER ( 'Table'[Serialnumber] ) && ( ( [closingdate] >= EARLIER ( 'Table'[closingdate] ) && [closingdate] <= EARLIER ( 'Table'[closingdate] ) + 30 ) || ( [reportingdate] <= EARLIER ( 'Table'[reportingdate] ) && [reportingdate] >= EARLIER ( 'Table'[reportingdate] ) - 30 ) ) ) ) RETURN IF ( _b = 1, "first time right", IF ( _a = 1, "right(not first time) ", "not right" ) )Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
Hi Rvd 18,
Tell me if it is ok for you
Anonymous
4 years agoNot applicable
Hi JamesFr06,
Thanks for your effort! This does work in the example but when I apply it to my dataset it doesn't give the correct values anymore... i've tried the formula proposed by Jianbo Li and this worked!