Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi, I have the following problem with SQL in Power BI advanced editor.
This ist my SQL code and I want to select every product with the highest average price.
The productnumber is the product-ID for the identification, "Quantity" is the quantity of the product and "QuantityPrice" the total amount of the buy.
Everything works fine apart from the subquery. Is I want to execute this part I get the following message:
Microsoft SQL: Divide by zero error encountered.
But there is no Divide by zero in the wohle calculation. Does anyone have an idea😐?
With Test1 as
(Select
T1.productnumber as productnumber ,
T1.Quantity,
T1.QuantityPrice as QuantityPrice
T1.Quantity/ T1.QuantityPrice as Price_per_product
from Table1 T1)
Select *, max(Price_per_product) over Test1.productnumber
where Price_per_product = (select ax(Price_per_product) over Test1.productnumber from Test1)
Hi @Do5779 ,
It's not this, is it?
Pete
Proud to be a Datanaut!
hi @BA_Pete thank you, but it was a typing error of me for this post. I should be "max(..."
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |