Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Community
I want to create a unique key that I can then join to another table with multiple rows. The purpose being that I can then recover the rows in the second table based on the key in the first table. I tried using the DateTime.FixedLocalNow() as part of the key but after joining to the second table the time is slightly different from the time in the created key and does not match. Any suggestions as to how to create the key.
Solved! Go to Solution.
I think you might be are out of luck there, M functions "update" when evaluated. If you need a "static" value that will have to be provided by a datasource. For example, the date/time a file or an export was created and so on.
Depending on your scenario and its complexity, you could generate a list or column of values (indices) from which you take the first "free" number...
Hi @TonyHollywood,
Create an separate query to hold the DateTime.FixedLocalNow() value
You can refer to that query by name when generating keys in both tables
I hope this is helpful
Hi @TonyHollywood ,
You are right. Don't know why you want to include time in your key but maybe consider:
1. Lowering the granularity, how about stripping off seconds?
DateTime.ToText( DateTime.FixedLocalNow(), [Format= "dd-MM-yyyy hh:mm"])
2. Round time for exampl up to quarters:
DateTime.From( Number.RoundUp( Number.From(DateTime.FixedLocalNow()) * ((24*60)/15), 0)/ ((24*60)/15))
3. Or setting an arbitrary time value
I hope this is helpful
Thanks again m_dekorte, really appreciate your help. At least I know now I am not going mad.
I am using the datetime as I want to generate a key that is unlikely to be replicated. Any suggestions as to how I can generate something unique out a function that will remain 'static' ?
I think you might be are out of luck there, M functions "update" when evaluated. If you need a "static" value that will have to be provided by a datasource. For example, the date/time a file or an export was created and so on.
Depending on your scenario and its complexity, you could generate a list or column of values (indices) from which you take the first "free" number...
Many thanks for your help m_dekorte.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
7 | |
7 | |
6 | |
6 |