Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi.
I have data as below. I would like to create 73 unique ID with date 2019-04-22, 56 unique ID with date 2019-04-23 etc. The ID for 2019-04-22 must not be the same as for 2019-04-23. How do I do this, please?
| Date | Qty |
| 2019-04-22 | 73 |
| 2019-04-23 | 56 |
| 2019-04-24 | 64 |
Thanks 🙂
Oh I see, you want the Qty as 1 from the script... do this
Table:
LOAD Date,
1 as Qty,
Num(Date)*100000+IterNo() as ID
While IterNo() <= Qty;
LOAD * INLINE [
Date, Qty
2019-04-22, 73
2019-04-23, 56
2019-04-24, 64
];Hard code the value to be 1, since it will always be 1 and nothing else
Try this
Table:
LOAD Date,
Qty,
Hash128(Date&IterNo()) as ID
While IterNo() <= Qty;
LOAD * INLINE [
Date, Qty
2019-04-22, 73
2019-04-23, 56
2019-04-24, 64
];
Hi.
Thanks for your reply. I don't seem to make your suggestion work, I get this very strange IDs. I also forget to tell that I want the quantity to be 1 for each ID, is that possible?
| ID | Qty |
| MOTH&P=2[:MLHK:PO=>/;& | 73 |
| MEP54NG.R:M,%=O2*Z,<;& | 73 |
| M3'<ZNY/U:ML[AH<!&H";& | 73 |
| M)#)(M#,L:M,,Z%.5!P";& | 73 |
Do you want to make an ID which makes sense? May be try this
Table:
LOAD Date,
Qty,
Num(Date)*100000+IterNo() as ID
While IterNo() <= Qty;
LOAD * INLINE [
Date, Qty
2019-04-22, 73
2019-04-23, 56
2019-04-24, 64
];For the second question, I am seeing 1 when I use Count(DISTINCT ID) with ID as the dimension
Oh I see, you want the Qty as 1 from the script... do this
Table:
LOAD Date,
1 as Qty,
Num(Date)*100000+IterNo() as ID
While IterNo() <= Qty;
LOAD * INLINE [
Date, Qty
2019-04-22, 73
2019-04-23, 56
2019-04-24, 64
];Hard code the value to be 1, since it will always be 1 and nothing else
This is perfect! Thank you very much.