March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi everyone, I have a difficulty in order to make something.
I need to: group by MASTERID, then order each row group(internally) by DateTime , create a new column in each group called ID, and create automatically an index from 1 to the last item in that group.
This is my table
masterid | user | date | time | state | internalid | datetime |
191753 | ZAICO | 2/1/2017 | 08:46:17 | PERDIDA | 438843 | 2/1/2017 08:46:17 |
191781 | ZAICO | 2/1/2017 | 08:47:16 | SEGUIMIENTO | 438844 | 2/1/2017 08:47:16 |
191952 | ZAICO | 2/1/2017 | 09:29:37 | INICIADA | 438847 | 2/1/2017 09:29:37 |
191954 | ZAICO | 2/1/2017 | 09:31:31 | INICIADA | 438848 | 2/1/2017 09:31:31 |
191954 | ZAICO | 2/1/2017 | 09:34:53 | SEGUIMIENTO | 438849 | 2/1/2017 09:34:53 |
191977 | VAB | 2/1/2017 | 09:35:28 | INICIADA | 438850 | 2/1/2017 09:35:28 |
191978 | ZAICO | 2/1/2017 | 09:38:49 | INICIADA | 438851 | 2/1/2017 09:38:49 |
191979 | ZAICO | 2/1/2017 | 09:41:16 | INICIADA | 438852 | 2/1/2017 09:41:16 |
191980 | ZAICO | 2/1/2017 | 09:58:42 | INICIADA | 438853 | 2/1/2017 09:58:42 |
191942 | VAB | 2/1/2017 | 09:56:03 | SEGUIMIENTO | 438854 | 2/1/2017 09:56:03 |
191981 | ZAICO | 2/1/2017 | 09:59:40 | INICIADA | 438856 | 2/1/2017 09:59:40 |
191982 | ZAICO | 2/1/2017 | 10:05:17 | INICIADA | 438857 | 2/1/2017 10:05:17 |
191882 | VAB | 2/1/2017 | 10:12:34 | INICIADA | 438860 | 2/1/2017 10:12:34 |
191737 | VAB | 2/1/2017 | 10:13:13 | INICIADA | 438861 | 2/1/2017 10:13:13 |
191756 | VAB | 2/1/2017 | 10:14:54 | INICIADA | 438862 | 2/1/2017 10:14:54 |
191850 | VAB | 2/1/2017 | 10:16:02 | INICIADA | 438863 | 2/1/2017 10:16:02 |
191872 | VAB | 2/1/2017 | 10:17:10 | INICIADA | 438865 | 2/1/2017 10:17:10 |
191875 | VAB | 2/1/2017 | 10:18:30 | INICIADA | 438866 | 2/1/2017 10:18:30 |
191959 | ZAICO | 2/1/2017 | 10:13:33 | INICIADA | 438867 | 2/1/2017 10:13:33 |
191984 | YOLAN | 2/1/2017 | 10:23:04 | INICIADA | 438868 | 2/1/2017 10:23:04 |
191985 | ZAICO | 2/1/2017 | 10:24:21 | INICIADA | 438869 | 2/1/2017 10:24:21 |
191985 | ZAICO | 2/1/2017 | 10:24:23 | SEGUIMIENTO | 438870 | 2/1/2017 10:24:23 |
191951 | VAB | 2/1/2017 | 10:19:34 | SEGUIMIENTO | 438871 | 2/1/2017 10:19:34 |
Can you give me an idea or help me with a new idea?
Thanks
Wait for your answers
Solved! Go to Solution.
Hi @gerojordan ,
Both PQ and DAX can be used, it's up to you.
Sort = RANKX(FILTER('Table','Table'[masterid]=EARLIER('Table'[masterid])),'Table'[datetime],,ASC,Dense)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @gerojordan ,
Both PQ and DAX can be used, it's up to you.
Sort = RANKX(FILTER('Table','Table'[masterid]=EARLIER('Table'[masterid])),'Table'[datetime],,ASC,Dense)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@gerojordan , Not very clear. But in case you need a index column based on sort order you can add a column in Dax
Rank index = RANKX(ALL(Table), Table[Datetime],,asc,dense)
Ranindex k = RANKX(ALL(Table), Table[Datetime],,asc,dense) + rank()/1000 -- in case there is some overlap and you want to avoid
I tried to be more clear...I rewrite all the question please check, thanks.
after grouping sorts in a new step by the date column and then you create an index column.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
126 | |
85 | |
69 | |
53 | |
44 |
User | Count |
---|---|
202 | |
106 | |
100 | |
64 | |
56 |