Forum Discussion
Help with Pareto chart
- 5 months ago
Hi thewookie ,
Believe I have found the question and is related with context of your calculations:
- Total Losses current syntax:
Total Losses= CALCULATE ( [Production Loss (MT)], FILTER ( ALLSELECTED ( 'Partial Data Set' ), 'Partial Data Set'[PERK] <> "Low Sales Demand" && 'Partial Data Set'[PERK] <> "Planned Maintenance" && 'Partial Data Set'[PERK] <> "Plant Turnaround (Strategic Outage)" && 'Partial Data Set'[PERK] <> "Weekend" && [Production Loss (MT)] > 0 ) )- The ALLSELECTED returns all rows in a table, or all the values in a columns, ignoring any filters that might have been applied inside the query, but keeping filters that come from outside. This means that when you apply the filter for the 80% that filter context is taken into consideration so your overall calculation is not on top of the full data but on the specific data you filter out
Then you have the question about the running loss:
- This calculation is done picking up the Running Loss measure and the getting the total losses, however when you filter the calculations based on the percentage the results get changed because the Running loss is nonw getting not only a filter at perk level but also at line level because it's part of the context
If you change the measure to the following you should get the proper result:
Total Losses Adjusted= CALCULATE ( [Production Loss (MT)], FILTER ( ALL ( 'Partial Data Set' ), 'Partial Data Set'[PERK] <> "Low Sales Demand" && 'Partial Data Set'[PERK] <> "Planned Maintenance" && 'Partial Data Set'[PERK] <> "Plant Turnaround (Strategic Outage)" && 'Partial Data Set'[PERK] <> "Weekend" && [Production Loss (MT)] > 0 ) ) Running Loss % Adjusted = DIVIDE( CALCULATE([Running Loss Measure], REMOVEFILTERS('Partial Data Set'[Line])), [Total Losses Adjusted] )
Has you can see the left side (filter adjusted measures) now maches the left side (no filter original measures).Be aware that this may need some more tweeks based on your model.
See PBIX file attached.
MFelix:
Thank you for the explanation. I knew it was somethingh stupoiid but I could not wrap my head around it. I'm sure you relize that once you get frustrated, it makes the job harder.
It's not a stupid thing.
Context transiction is very difficult specially with complex models and calculations.
Don't forget to accept the correct answer to help others.
- thewookie5 months agoHelper I
OK. SO it is WAY better. However, I noticed that with the ciolumn legends applied, even though I have the filter set to <=80%, it shows the 94.62% bar, but withouht column legends, it shows correctly. Any ideas?:
- MFelix5 months agoSuper User
Hi thewookie ,
Are the columns that you are using on your visualization coming from the fact table or from the dimensions table?
Asking this because you mockup model only had a single table and the way you make the calculation is impacted by the way you build your model so relationships, tables, filtering direction, and so on.