Forum Discussion
selecting rows with max/unique value
Hi Everyone,
Can someone help me with the following scenario. I even don’t understand how I should solve it..
I have a table of values
ID | CounterNumber | ReqDateT | DataDateT | SummAPlus |
68511 | 139 | 2018-02-06 17:14:45.000 | 2018-02-05 00:00:00.000 | 11632,8 |
68512 | 139 | 2018-02-06 17:14:54.000 | 2018-02-05 00:00:00.000 | 11632,8 |
68529 | 149 | 2018-02-06 17:17:16.000 | 2018-02-05 00:00:00.000 | 1075 |
68530 | 149 | 2018-02-06 17:17:20.000 | 2018-02-05 00:00:00.000 | 1075 |
68599 | 1 | 2018-02-06 17:22:51.000 | 2018-02-05 00:00:00.000 | 4933,6 |
68600 | 1 | 2018-02-06 17:22:55.000 | 2018-02-05 00:00:00.000 | 4933,6 |
68629 | 139 | 2018-02-06 21:00:16.000 | 2018-02-05 00:00:00.000 | 11632,8 |
68638 | 149 | 2018-02-06 21:02:23.000 | 2018-02-05 00:00:00.000 | 1075 |
68673 | 1 | 2018-02-06 21:06:54.000 | 2018-02-05 00:00:00.000 | 4933,6 |
68159 | 139 | 2018-02-05 07:00:24.000 | 2018-02-04 00:00:00.000 | 14162,4 |
68168 | 149 | 2018-02-05 07:02:31.000 | 2018-02-04 00:00:00.000 | 926,8 |
68203 | 1 | 2018-02-05 07:07:43.000 | 2018-02-04 00:00:00.000 | 5631,6 |
68218 | 139 | 2018-02-05 12:24:19.000 | 2018-02-04 00:00:00.000 | 14162,4 |
68219 | 139 | 2018-02-05 12:24:28.000 | 2018-02-04 00:00:00.000 | 14162,4 |
68236 | 149 | 2018-02-05 12:26:50.000 | 2018-02-04 00:00:00.000 | 926,8 |
68237 | 149 | 2018-02-05 12:26:55.000 | 2018-02-04 00:00:00.000 | 926,8 |
68304 | 1 | 2018-02-05 12:33:35.000 | 2018-02-04 00:00:00.000 | 5631,6 |
I need to select rows with max(or unique) value of “SummAPlus” for each “CounterNumber” for each “DataDateT”
Further I’ll calculate a sum of “SummAPlus” for the whole month/year and use it in other measures, so I need to select only 1 value for the period(DataDateT)…
And I don’t understand what should I do, create the new table with cleaned data (1 Date = 1 Row ), or it may be somehow selected by a measure?