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.
v-jianboli-msft
Community Support
4 years agoHi 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
Thanks!!!😀