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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
We are trying to replicate our SQL Server reports in powerbi.
One of the calculations works out awaiting orders.
Select NA1.WAREHOUSE_CODE,
COUNT(DISTINCT NA1.SALES_DOCUMENT_NUM) AS CanFulfill
INTO #CanFulfill
FROM #NewAwaiting NA1
WHERE (SELECT SUM(NA2.BACKORDERED) FROM #NewAwaiting NA2 WHERE NA1.SALES_DOCUMENT_NUM = NA2.SALES_DOCUMENT_NUM) = 0
AND NA1.SALES_RQD_QUANTITY > 0
GROUP BY NA1.WAREHOUSE_CODE
ORDER BY NA1.WAREHOUSE_CODEHowever if we try
Awaiting = CALCULATE(DISTINCTCOUNT(Query1[SALES_DOCUMENT_NUM]),sum(Query1[BACKORDERED])=0, Query1[SALES_RQD_QUANTITY]>0)
It comes back saying cant use sum in a true false.
What is the best way to do this?
Thanks
It's quite challenging to get an answer from this information. It relies on knowing advanced SQL and then creating a mental model in one's head then trying to convert that to a powerbi model.
The above 2 queries aren't doing the same thing anyway. The SQL returns a temp table with 2 columns after doing a self-join on another temp table. We don't know if Awaiting is a column or measure.
It worries me that the powerbi table is called Query1, rather than Sales or something like that.
I suggest that you post some data and desired output with an explanation of your model and whether you want a calculated column or measure. Someone will help you.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 14 | |
| 7 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 10 | |
| 10 | |
| 6 | |
| 5 |