Jump to content
We've recently updated our Privacy Statement, available here. ×

I need help writing logic in calculated column to give results below. ID date ProdFlag NormTime XYZ1 8/31/2023 1 3 XYZ1 8/31/2023 1 3 XYZ1 7/31/2023 1 2 XYZ1 7/31/2023 1 2 XYZ1 7/31/2023 1 2 XYZ1 7/31/2023 1 2 XYZ1 6/30/2023 1 1


Kate E 2

Recommended Posts

Thank you for reply. I added table as an example output for the normalized time calculation. I want to calculate a column which calculates normalized time but ONLY counts it once per individual date and ID. I.e. the table result example but this will be for hundreds of thousands of rows.

Link to comment
Share on other sites

Yes- normalized time is the calculated column. I was just giving the specific notes as to how that should be calculated.

I have raw data of ID and Date. I calculate the production flag( no issues ) and want to calculate normalized time column which would result in results consistent with the table.

Link to comment
Share on other sites

Will this help to create a new column called NormTime?

If( DenseRank() Over (Partition By [iD] Order By [Date]) = 1, DenseRank() Over (Partition By [iD] Order By [Date]), DenseRank() Over (Partition By [iD] Order By [Date]))

NormTime should increase by 1 for each unique combination of ID and Date.

DenseRank assigns a rank to each unique combination of ID and Date based on the order of Date..If the rank is 1 for a particular combination, it assigns that rank as the NormTime value. And if it is greater than 1, assigns the same rank as 'NormTime' increases by 1

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...