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

show min and max date for a customer in two diff columns of the customer table

I have a data like:

Customer ID         Delivery Date        Sales Man Visit Date (SM Visit Date)

1                                 01/01/2019            03/01/2019

1                                  29/01/2019            30/01/2019

1                                  21/02/2019            23/02/2019

2                                  17/12/2018             18/12/2018

2                                  05/01/2019              07/01/2019

 

My desired output:

C. ID         First Delivery Date      SM Visit Date     Second Delivery Date      SM Visit Date       Last Delivery Date     SM Visit Date

1                01/01/2019                     03/01/2019        29/01/2019                           30/01/2019           21/02/2019                  23/02/2019

2                17/12/2018                     18/12/2018        05/01/2019                           07/01/2019

                             

 

6 Replies
Channa
Specialist III
Specialist III

try Generic Load

Channa
dplr-rn
Partner - Master III
Partner - Master III

I am assuming you want the output on the UI side.

Use something like below

Dimension - User ID

Measures

First Delviery date - Date(Min([Delivery Date]),'DD\MM\YYYY')

Visit Date - Date(FirstSortedValue([Sales Man Visit Date (SM Visit Date)],[Delivery Date]),'DD\MM\YYYY')

Second Delviery date - Date(Min([Delivery Date],2),'DD\MM\YYYY')

 

output

Capture.jpg

Visit Date - Date(FirstSortedValue([Sales Man Visit Date (SM Visit Date)],[Delivery Date],2),'DD\MM\YYYY')

Last Delivery Date - Date(Max([Delivery Date]),'DD\MM\YYYY')

Channa
Specialist III
Specialist III

i tried but they were not working

Channa
dplr-rn
Partner - Master III
Partner - Master III

Check your data model to see if the date is being recognized as a date
Channa
Specialist III
Specialist III

please find the attach data

Channa
dplr-rn
Partner - Master III
Partner - Master III

from the excel you shared the deliverydate is not being recognized correctly as a Date but as a text.

in the excel you shared there is a trailing space after the values in that column. i removed it and it works correctly.

I think you will need to change your source excel somehow. because i tried trim and date functions before removing the trailing spaces it didnt work.

not 100% sure why