PDA

View Full Version : PQ - Median of dates



sandy666
05-09-2020, 08:51 PM
Median of dates


B
C
D
E
F
G

2DateValueCountifDateMedian


3
19/04/2020
1
1
19/04/2020
4.5


4
19/04/2020
2
2
20/04/2020
2.5


5
19/04/2020
3
3
21/04/2020
3


6
19/04/2020
4
4
22/04/2020
2


7
19/04/2020
5
5


8
19/04/2020
6
6


9
19/04/2020
7
7


10
19/04/2020
8
8


11
20/04/2020
9
1


12
20/04/2020
10
2


13
20/04/2020
11
3


14
20/04/2020
12
4


15
21/04/2020
13
1


16
21/04/2020
14
2


17
21/04/2020
15
3


18
21/04/2020
16
4


19
21/04/2020
17
5


20
22/04/2020
18
1


21
22/04/2020
19
2


22
22/04/2020
20
3


=COUNTIF(B$3:B3,B3)


let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Type = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Value", Int64.Type}}),
Group = Table.Group(Type, {"Date"}, {{"Median", each List.Median([Countif]), type number}})
in
Group