It took me a while to get this working, mainly due to my lack of knowledge in doing these queries. This will grab the version number of the Office 365 installation and give the total amount of clients with that version. In turn it can be used for chart widgets.
Select Top 1000000 tblSoftware.softwareVersion,
Count(tblAssets.AssetID) As Total,
tblSoftware.softwareVersion As Version
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblSoftware On tblAssets.AssetID = tblSoftware.AssetID
Inner Join tblSoftwareUni On tblSoftwareUni.SoftID = tblSoftware.softID
Where tblSoftwareUni.softwareName Like '%microsoft office%365%' And
tblAssetCustom.State = 1 And tblAssets.Assettype = -1
Group By tblSoftware.softwareVersion
Order By Version,
Total Desc