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.
I'm having real problems writing a measure to return the first value in a column based on whether another column is blank or not.
I have 2 tables - Price History and Sales. They are joined by a one to many relationship based on a key (a concatentation of service code & unit price.).
I want to write a measure that will return the first (as in earliest) value where the Quantity Sold is not blank for each part (or StdSvcKey). So in the case below the number I want for this part is £621.86.
I've tried 2 different methods so far but they dont do what i want.
I tried:
Solved! Go to Solution.
Hi @PhoenixBird66 ,
Please try this formula below, which is more intuitive.
Measure 2 = MINX ( TOPN ( 1, FILTER ( 'Table1', 'Table1'[Quantity Sold] <> BLANK () ), Table1[Start Date], ASC ), [Unit Price] )
Best Regards,
Hi @PhoenixBird66 ,
Could you please mark the proper answers as solutions?
Best Regards,
Hi @PhoenixBird66 ,
Try this simpler one. The key point here is the row context that we need to convert.
Measure = FIRSTNONBLANK ( Table1[Unit Price], CALCULATE ( SUM ( Table1[Quantity Sold] ) ) )
Best Regards,
Thanks for your response.
I've tried this but it seems to be picking up the first (as in smallest) value rather than the first (as in oldest value). So in this example it returns the value £25.12, but I want it to return the value £26.00.
I need it to return the OLDEST unit price (based on the Start Date column) where the Quantity Sold is not blank or zero.
Hi @PhoenixBird66 ,
Could you please mark the proper answers as solutions?
Best Regards,
Hi @PhoenixBird66 ,
Please try this formula below, which is more intuitive.
Measure 2 = MINX ( TOPN ( 1, FILTER ( 'Table1', 'Table1'[Quantity Sold] <> BLANK () ), Table1[Start Date], ASC ), [Unit Price] )
Best Regards,
hi,
this might be happening because you have some page filter on.
please see the link below, this will give you a clear understanding
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 |
---|---|
76 | |
76 | |
55 | |
36 | |
34 |
User | Count |
---|---|
99 | |
56 | |
53 | |
44 | |
40 |