Forum Discussion
Difference between current Date row and MIN Date row
1. I want to find the difference of the sales b/w that current row and the row of the Min Date while the same port name as well.
2. Also, I would like to find the difference b/w current row and min date. I tried Datediff already but the problem is that i dont know what the function for current date row.
Thanks.
| Dates | Ports | Sales | Diff of Sales between Current Date and Start of Ports | Date Diff Between Curret Row and Start of the Port |
| 3/2/2019 | A | 20,903.00 | (682,802.00) | 6634 |
| 3/2/2019 | B | 124,942.00 | (549,068.00) | 6634 |
| 3/2/2019 | C | 462,661.00 | (381,642.00) | 6634 |
| 3/2/2019 | D | 879,744.00 | 807,788.00 | 6634 |
| 3/2/2019 | E | 458,229.00 | (137,630.00) | 6634 |
| 3/2/2019 | F | 564,806.00 | (2,216.00) | 6634 |
| 3/2/2019 | G | 535,679.00 | 192,355.00 | 6634 |
| 3/2/2019 | H | 509,409.00 | 425,038.00 | 6634 |
| 3/2/2019 | I | 396,817.00 | (488,996.00) | 6634 |
| 3/2/2019 | J | 406,300.00 | 352,183.00 | 6634 |
| 2/7/2018 | A | 953,029.00 | 249,324.00 | 6246 |
| 2/7/2018 | B | 116,359.00 | (557,651.00) | 6246 |
| 2/7/2018 | C | 349,101.00 | (495,202.00) | 6246 |
| 2/7/2018 | D | 794,063.00 | 722,107.00 | 6246 |
| 2/7/2018 | E | 758,795.00 | 162,936.00 | 6246 |
| 2/7/2018 | F | 362,260.00 | (204,762.00) | 6246 |
| 2/7/2018 | G | 599,135.00 | 255,811.00 | 6246 |
| 2/7/2018 | H | 6,308.00 | (78,063.00) | 6246 |
| 2/7/2018 | I | 907,120.00 | 21,307.00 | 6246 |
| 2/7/2018 | J | 458,158.00 | 404,041.00 | 6246 |
| 1/1/2001 | A | 703,705.00 | ||
| 1/1/2001 | B | 674,010.00 | ||
| 1/1/2001 | C | 844,303.00 | ||
| 1/1/2001 | D | 71,956.00 | ||
| 1/1/2001 | E | 595,859.00 | ||
| 1/1/2001 | F | 567,022.00 | ||
| 1/1/2001 | G | 343,324.00 | ||
| 1/1/2001 | H | 84,371.00 | ||
| 1/1/2001 | I | 885,813.00 | ||
| 1/1/2001 | J | 54,117.00 |
Hi chaichatp ,
For your requirement, please create the measure below.
1. I want to find the difference of the sales b/w that current row and the row of the Min Date while the same port name as well.
slaes for mindate = CALCULATE ( MAX ( 'table'[ Sales ] ), FILTER ( ALLEXCEPT ( 'table', 'table'[Ports] ), 'table'[Dates] = MIN ( 'table'[Dates].[Date] ) ) ) Diff of Sales between Current Date and Start of Ports = CALCULATE(MAX('table'[ Sales ]))-[slaes for mindate]2. Also, I would like to find the difference b/w current row and min date. I tried Datediff already but the problem is that i dont know what the function for current date row.
mindate = CALCULATE ( MIN ( 'table'[Dates] ), ALLEXCEPT ( 'table', 'table'[Ports] ) ) Date Diff Between Curret Row and Start of the Port = DATEDIFF([mindate],CALCULATE(MAX('table'[Dates])),DAY)Here is the output.
Hope this can help you!
Best Regards,Cherry
1 Reply
- v-piga-msft
Resident Rockstar
Hi chaichatp ,
For your requirement, please create the measure below.
1. I want to find the difference of the sales b/w that current row and the row of the Min Date while the same port name as well.
slaes for mindate = CALCULATE ( MAX ( 'table'[ Sales ] ), FILTER ( ALLEXCEPT ( 'table', 'table'[Ports] ), 'table'[Dates] = MIN ( 'table'[Dates].[Date] ) ) ) Diff of Sales between Current Date and Start of Ports = CALCULATE(MAX('table'[ Sales ]))-[slaes for mindate]2. Also, I would like to find the difference b/w current row and min date. I tried Datediff already but the problem is that i dont know what the function for current date row.
mindate = CALCULATE ( MIN ( 'table'[Dates] ), ALLEXCEPT ( 'table', 'table'[Ports] ) ) Date Diff Between Curret Row and Start of the Port = DATEDIFF([mindate],CALCULATE(MAX('table'[Dates])),DAY)Here is the output.
Hope this can help you!
Best Regards,Cherry