cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

## Calculate the number of weeks between the two date rows

Hi,

I need to calculate the number of weeks between the two date rows based on the category start date and finish date as shown below

1 ACCEPTED SOLUTION
Community Support

Hi @Anonymous

Try to use datediff function in your code.

Weekdiff =
VAR _T =
SUMMARIZE (
'Table',
'Table'[SDCCode],
"Weekdiff",
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( 'Table', 'Table'[Category] = "03.WO Load Start Date" )
)
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( 'Table', 'Table'[Category] = "04.WO Load Finish Date" )
)
RETURN
)
RETURN
SUMX ( _T, [Weekdiff] )

Result is as below.

Best Regards,
Rico Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support

Hi @Anonymous

Try to use datediff function in your code.

Weekdiff =
VAR _T =
SUMMARIZE (
'Table',
'Table'[SDCCode],
"Weekdiff",
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( 'Table', 'Table'[Category] = "03.WO Load Start Date" )
)
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( 'Table', 'Table'[Category] = "04.WO Load Finish Date" )
)
RETURN
)
RETURN
SUMX ( _T, [Weekdiff] )

Result is as below.

Best Regards,
Rico Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.