Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
chaichatp
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
v-piga-msft
Resident Rockstar
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.

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
v-piga-msft
Resident Rockstar
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.

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.