Forum Discussion
Using SUM in a Calculated Column returns unexpected results
- 8 years ago
Under visualization pane in the values Click on the "ratio" column and click on the last value "show value as" and click percent of grand total.
This should give you the desired result.
Thanks
Hi Anonymous
Instead of creating Calculated column for Total Revenue, try to create calculated measure.By doing so you can see 600 when you apply slicers/filters.
Thanks
- Anonymous8 years agoNot applicable
Thanks for the quick response.
Eventually what I want to do is take the Revenue and Divide it by the Total_Revenue_Col for each row in order to the get the % for the selected Region.
In this case the if I create the Measure as the SUM of the Revenue column and drag into the table it will still be equivalent to the Revenue field due to the context created by the surrouding area.
I am wondering why the logic with the Calcualted Column using the SUM does not work as expected. I've seen it documented in several places that it should work, I.e., the value from the Slicer gets applied to the table containing the data and then the Calcualted Column expression is executed on what is returned.
- sqlguru4488 years agoHelper III
If you are trying to Divide, you can create a calculated column using DAX in powerbi
DIVIDE(Region[Revenue]|SUM(Region[Revenue])|0)
if you want to see slice and dice for divide column as well then I would suggest you to create a new divide measure which will change based on selection in your slicer.
- Anonymous8 years agoNot applicable
I add the Calculated Column Ratio = DIVIDE(Regions[Revenue],sum(Regions[Revenue]),0). The result is above. It still has the same effect,I.e., dividing by the entire sum rather than just the sum for Asia which should be 600.
Thanks.