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
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
Super User
Super User

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
Super User
Super User

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
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.