cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

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.

 

DatesPorts Sales Diff of Sales between Current Date and Start of PortsDate Diff Between Curret Row and Start of the Port
3/2/2019A      20,903.00                                                                                                 (682,802.00)6634
3/2/2019B   124,942.00                                                                                                 (549,068.00)6634
3/2/2019C   462,661.00                                                                                                 (381,642.00)6634
3/2/2019D   879,744.00                                                                                                   807,788.006634
3/2/2019E   458,229.00                                                                                                 (137,630.00)6634
3/2/2019F   564,806.00                                                                                                       (2,216.00)6634
3/2/2019G   535,679.00                                                                                                   192,355.006634
3/2/2019H   509,409.00                                                                                                   425,038.006634
3/2/2019I   396,817.00                                                                                                 (488,996.00)6634
3/2/2019J   406,300.00                                                                                                   352,183.006634
2/7/2018A   953,029.00                                                                                                   249,324.006246
2/7/2018B   116,359.00                                                                                                 (557,651.00)6246
2/7/2018C   349,101.00                                                                                                 (495,202.00)6246
2/7/2018D   794,063.00                                                                                                   722,107.006246
2/7/2018E   758,795.00                                                                                                   162,936.006246
2/7/2018F   362,260.00                                                                                                 (204,762.00)6246
2/7/2018G   599,135.00                                                                                                   255,811.006246
2/7/2018H         6,308.00                                                                                                    (78,063.00)6246
2/7/2018I   907,120.00                                                                                                      21,307.006246
2/7/2018J   458,158.00                                                                                                   404,041.006246
1/1/2001A   703,705.00  
1/1/2001B   674,010.00  
1/1/2001C   844,303.00  
1/1/2001D      71,956.00  
1/1/2001E   595,859.00  
1/1/2001F   567,022.00  
1/1/2001G   343,324.00  
1/1/2001H      84,371.00  
1/1/2001I   885,813.00  
1/1/2001J      54,117.00  
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resident Rockstar
Resident Rockstar

Re: Difference between current Date row and MIN Date row

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.

Capture.PNG
Hope this can help you!
Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Highlighted
Resident Rockstar
Resident Rockstar

Re: Difference between current Date row and MIN Date row

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.

Capture.PNG
Hope this can help you!
Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors