Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have this following query :
SELECT * FROM (
SELECT Vendor,[Material Type]
,SUM([Total Defect Qty]) AS [Sum]
,YEAR([Date]) as [Date]
, RANK() OVER(PARTITION BY Vendor,YEAR([Date]) ORDER BY SUM([Total Defect Qty]) DESC) AS rn
FROM SupplierQuality
GROUP BY Vendor,[Material Type],YEAR([Date])
) AS T
WHERE T.rn=1
ORDER BY Vendor,[Date],[Sum] DESC
I need to do the same in Power BI but my data source isn't a SQL Server database, it's an Excel file.
How can I get the max of the summed [Total Defect Qty] ?
I have the following data returned by the query above :
For example, for the vendor Abata I need to get only the max Sum for 2018 and 2019
Solved! Go to Solution.
I ended up creating a calculated table :
I ended up creating a calculated table :
In this ribbon in the query editor, click on the Group By button, choose advanced and set up Group By on Vendor, Material Type, and Date columns, and then choose Max as the aggregation of the Sum column.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!