cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Santhosh_V
Regular Visitor

Need to add serial number based on the date

Hi All,

 

I've 200+ rows of call history data and It will have multiple entries for each day for each users. I would like to add the serial number accordingly to start date to use it on a slicer. Below is the screenshot fo the data,

 

If start date is 2023-01-04, then serial number would be 1,

if start date is 2023-01-05, then serial number would be 2....

 

Any help on this would be appreciated.

 

Santhosh_V_1-1675831574528.png

Thank you.

2 ACCEPTED SOLUTIONS
FreemanZ
Community Champion
Community Champion

hi @Santhosh_V 

try to add a column like:

Serial Number  =
INT( 
    DATE(
        LEFT([StartDateTime], 4), 
        MID([StartDateTime], 6, 2),
        MID([StartDateTime], 9, 2)  
    ) -
    DATE(2023, 1 ,4) +1
)

View solution in original post

hi @Santhosh_V 

it shall still work. Try with your data and let us know. 

View solution in original post

4 REPLIES 4
v-yueyunzh-msft
Community Support
Community Support

Hi , @Santhosh_V 

According to your description, you want to add a rank column from the "Date/Time" column (just compare the date not the time).

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1675910409015.png

(2)We can click "New Column" and enter this:

Column = RANKX('Table',DATEVALUE( FORMAT('Table'[Date],"yyyy-mm-dd")),,ASC,Dense)

 

(3)Then we can meet your need:

vyueyunzhmsft_1-1675910443489.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

FreemanZ
Community Champion
Community Champion

hi @Santhosh_V 

try to add a column like:

Serial Number  =
INT( 
    DATE(
        LEFT([StartDateTime], 4), 
        MID([StartDateTime], 6, 2),
        MID([StartDateTime], 9, 2)  
    ) -
    DATE(2023, 1 ,4) +1
)

Hi @FreemanZ,

 

Thanks for your response.

 

May i know whether will this work if date value has changed?

Because the start date will get varied on monthly basis..

 

Thank you.

hi @Santhosh_V 

it shall still work. Try with your data and let us know. 

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors