Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello,
I'm trying to set 3 different dax metrics to get the 1st,2nd,3rd values of a product price (for diferents urls).
product_id | url_id | LastPrice | product_price | InvalidPrice |
158946 | 1123584 | 1 | 14,77 | 0 |
158946 | 2541222 | 1 | 14,77 | 0 |
158946 | 455333 | 1 | 30,54 | 0 |
158946 | 5648124 | 1 | 15,23 | 1 |
158946 | 1325444 | 1 | 27,9 | 0 |
Best Price= 14,77
Second best price=14,77
Third best price=27,90
Browsing the forum I have found this formula and it works when they are not duplicated values.
Second Best Price =
SUMx (
TOPN(1,
TOPN ( 2, FILTER(priceregistrationraw,and(NOT(priceregistrationraw[InvalidPrice]=1),priceregistrationraw[LastPrice]=1)), [price] , ASC ),
[price] , DESC
),
CALCULATE ( min ( priceregistrationraw[price])))
But as long as Top N shows duplicates, it sums their values. Can you help me?
thanks in advance!
Solved! Go to Solution.
Hi @riguberto ,
Is this what you are looking for.
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Hi @riguberto ,
Create a Calculated Column
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
@riguberto , Try like
rank = rankx(FILTER(priceregistrationraw,and(NOT(priceregistrationraw[InvalidPrice]=1),priceregistrationraw[LastPrice]=1)),[price],,ASC,Dense)
Second Best Price =
sumx(filter(priceregistrationraw,[Rank]=2),CALCULATE ( min ( priceregistrationraw[price])))
Thanks for your response.
rank... creating this metric pop up the error: can't determine the value of price. Maybe the column doesn't exist or it is no rows (translating myseflt from spanish... :S)
ok, I didn't understood that rank was a column in the priceregistrationraw table (I was trying as a metric (I'm totally newby)).
My problem now is that the table has more products_id and they are getting ranked all together. I tried to put a product_id filter, but now the filter for lastprice and isvalid are not working (the product_id looks fine)...
What I tried
Hi @riguberto ,
Is this what you are looking for.
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Thanks! this solution is working.
My only concerne is about performarnce. The priceregistrationraw table is a fact table with more than 10Million rows... is efficient to create a new table with the same info?
thanks again
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.