Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
I need to create a measure (and it has to be a measure, not a column, due wider reports/ calculations/ interdependencies). I need that measure to return the Ref which relates to the first start date. In the event that the first start date occurs twice or more, I need it to return the first occurrence.
Example data is below:
Ref | Start Date |
123456 | 01/01/2021 |
789123 | 03/04/2021 |
456019 | 09/05/2021 |
839213 | 12/05/2021 |
127459 | 01/01/2021 |
293022 | 27/02/2021 |
934859 | 13/02/2021 |
294850 | 15/04/2021 |
930573 | 18/04/2021 |
2938502 | 29/05/2021 |
754392 | 23/03/2021 |
So, from my data above, the first start date is 01/01/21 - that occurs with refs 123456 and 127459, so I'd want the answer to be 123456.
I can obviously get a measure which lists the first start date using Min, but beyond that I'm hitting a wall.
Would be very grateful for any advice.
Thanks
Solved! Go to Solution.
@JamesCarter try this meaure
Top Ref = CALCULATE ( MIN ( Ref[Ref] ), TOPN ( 1, ALLSELECTED ( Ref ), Ref[Start Date], ASC ) )
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi,
Try these measures
First date = MIN(Data[Start Date])
Measure = FIRSTNONBLANK ( TOPN ( 1, VALUES (Data[Ref]), [First date],ASC ), 1 )
Drag the second measure to a card visual. The result will be 123456.
Hi,
Try these measures
First date = MIN(Data[Start Date])
Measure = FIRSTNONBLANK ( TOPN ( 1, VALUES (Data[Ref]), [First date],ASC ), 1 )
Drag the second measure to a card visual. The result will be 123456.
Actually ignore that bit about variable.
I thought it had worked, but it hadn't - so I've reverted to what you did and that remains perfect.
Thanks again
James
Thanks Ashish,
Absolute superstar. That worked a treat.
I tweaked slightly to make the first measure a variable and I'm absolutely getting the result.
Brilliant stuff - very grateful. I'd been playing with FIRSTNONBLANK, MIN and TOPN but just couldn't get it - haven't used ASC before. That's a new string to the bow!
Thanks again
You are welcome.
@JamesCarter try this meaure
Top Ref = CALCULATE ( MIN ( Ref[Ref] ), TOPN ( 1, ALLSELECTED ( Ref ), Ref[Start Date], ASC ) )
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k
I really should properly wait to investigate before replying - lesson for the future.
I've found what I did wrong in the previous attempt and yes, absolutely, your solution worked.
Thanks again
Hi @parry2k
Thanks so much for responding and for your proposal.
I couldn't quite get it to work (it wouldn't let me call the start date). Sure it's something I did wrong in translating the measure to my actual table.
Happily @Ashish_Mathur 's solution worked, but I'm really grateful for your time and offer of help.
I do love the support people offer on these forums.
Thanks again
James
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
75 | |
68 | |
41 | |
35 |
User | Count |
---|---|
102 | |
56 | |
52 | |
46 | |
40 |