Forum Discussion
Sum and Order by from table
If I'm understanding you correctly, you have 2 fields in your field list on the right hand side of Power BI Desktop: Employee and Hours (see screenshot below). When you drag them onto a visualization (such as a table or card) they show each individual row in the underlying Excel sheet instead of summing up.
There are two options, both have the same result:
1. Once you've created your visualization with Employee and Hours underneath in the 'Fields' list of the visualization, there should be a drop down next to Hours. You can click this and instead of 'Do Not Summarize', select 'Sum'. (In the below screenshot I'm using the card visualization)
2. On the data tab (2nd icon on the far left of Power BI Desktop) or by right-clicking in your field list on the far right, create a new measure called Total Hours, defined as Total Hours = SUM(Sheet1[Hours]) (where Sheet1 is the name of your Excel sheet). You can then use this measure instead of hours in your visualizations.
The 2nd method, though a bit of an extra step, is the better practice. My reasoning:
1. As you get more advanced, your measures will go beyond simple sums, counts & averages that the first option is limited to.
2. With the 2nd method you can give it a specific name ("Total Hours" so it's clear that it's a sum and not, say, an average).
3. The 1st method has to be repeated for every visualization you create whereas the measure created in the 2nd method persists in your model forever more and can be selected again and again.
4. If you ever want to change the definition of "Total Hours" (e.g. you want to always exclude managers from the measure or you want to subtract a fixed amount of time for lunch breaks each day), you can change the measure in the future and all the visualizations that use it will automatically reflect the change.
Hope this helps.
For some of my columns, I do not see this dropdown to change from count to sum. I only see count and distinct count. I tried changing the format of the cells in my excel data sheet to numeric but it did not work.