Forum Discussion
Dynamic percentage based on attributes applied
- Anonymous8 years ago
Ok great, the formatting must have been the elusive element.
Doing some quick maths:
208764.42 / 37968039.17 = 0.005498425. As a percentage that should be 0.54%. So that means you are correct in that its 100 times too small, plus the number itself is wrong.
Lets create 2 more measures.Numerator = SUM('YourTable'[SumActualCost]) Denominator = SUM('YourTable'[Total Cost])Bring those into the matix next. I'm curious what that comes up with.
For the reason the reason it doesn't add to 100%, i believe My error is with Total Cost. Instead of SUM for the Denominator, we should use MAX instead. This is because you don't actually want to sum up that column.
- Anonymous8 years ago
No definately not, thats not necessary. Does your formula now look like?
Simple % = DIVIDE( [Numerator], [Denominator] )Remembering Numerator and Denominator are measures, so we can call them directly in our new Measure.
Yes, applying the slicer currently doesn't change the total value it's calculating from. The percentage should total to 100% on the visual if that was the case.
This would likely be an issue with your data and your data relations.
All our measure do is sum up the individual rows, for both 'ActualCost' and 'TotalCost'. The slicers will be adding a context to limit what is contained in both of those summations.
As to why it doesn't add to 100%, this will be entirely dependant on how your TotalCost column has had it data populated. When selecting a subset of the data, yes you will be adding up less TotalCost lines, but i'm unable to say whether that change in context causes some invalidation of your information.
- Anonymous8 years agoNot applicable
Hi
I created a new file with only the main table, without any transformations made to it. I added the measures and the same thing still happens. When a slicer is applied, the percentages don't recalculate to show the ratio within that selection. It appears to be hard-coded to the overall total cost rather than being dynamic. Is there a change I could try to the measures formulae?
Thanks
- Anonymous8 years agoNot applicable
The slicers you are using, are they from the same table as the data or are the slicers referencing another table? Is the table relationships correct to enable your slicers to work?
- Anonymous8 years agoNot applicable
In the original file (with multiple tables and transformations) the slicer is from the same table as the measures. In the new file there is only one table and no transformations - so the slicer is from the same table as the measures again.
The formula used for Total Cost is:
Original file (where the table has been grouped): Total Cost = SUM('AssignmentTPDS'[SumActualCost])
New file (where the table hasn't been grouped): Total Cost = SUM('Query1'[AssignmentActualCost])
- Anonymous8 years agoNot applicable
Anonymous - have you had anymore thoughts on this?
- Anonymous8 years agoNot applicable
Sorry Anonymous no I haven't. As described, it should work. Based on everything you have put forward, it should work. There must be another unseen element at play.