Forum Discussion
Help Creating a Waterfall Chart using Pareto 80/20 Principal
- 1 year ago
Hi JST15 ,
Creating a dynamic waterfall chart in Power BI that visualizes the 80/20 Pareto principle for variance analysis is an excellent way to derive deep insights from your financial data. Your initial instinct to use a virtual table is understandable, but a more flexible and robust solution can be achieved by leveraging a series of DAX measures. This measure-based approach ensures your visuals react seamlessly to any slicer or filter applied to the report, providing a truly interactive experience. The strategy is to calculate the variance, rank the positive and negative variances separately, determine their cumulative contribution, and then dynamically group any accounts falling outside the top 80% into an "Other" category directly within the measures that power the chart.
First, you must establish the foundational measures for your actuals, planned amounts, and the variance between them. These form the basis for all subsequent calculations.
Total Actuals = SUM(Actuals[Actual Amount])Total Plan = SUM(Budget[Plan Amount])Variance = [Total Actuals] - [Total Plan]With the core Variance measure created, the next step is to rank the accounts based on this variance. To handle both favorable and unfavorable variances correctly, you should create two separate ranking measures: one for positive variances, ordered descendingly, and another for negative variances, ordered ascendingly. Using ALLSELECTED is critical here, as it ensures the ranking dynamically adjusts to any active filters on your report page.
Positive Variance Rank = RANKX( FILTER( ALLSELECTED('Accounts'), [Variance] > 0 ), [Variance], , DESC )Negative Variance Rank = RANKX( FILTER( ALLSELECTED('Accounts'), [Variance] < 0 ), [Variance], , ASC )Now you can calculate the cumulative running total as a percentage of the total variance, which is the heart of the Pareto analysis. These measures will check the rank of the current account and sum up the variance for all accounts with an equal or better rank. This cumulative sum is then divided by the total positive or negative variance, respectively, to get the cumulative percentage.
Cumulative Positive Variance % = VAR TotalPositiveVariance = CALCULATE( [Variance], FILTER(ALLSELECTED('Accounts'), [Variance] > 0) ) VAR CumulativePositiveVariance = CALCULATE( [Variance], FILTER( ALLSELECTED('Accounts'), [Positive Variance Rank] <= [Positive Variance Rank] && [Variance] > 0 ) ) RETURN DIVIDE(CumulativePositiveVariance, TotalPositiveVariance)Cumulative Negative Variance % = VAR TotalNegativeVariance = CALCULATE( [Variance], FILTER(ALLSELECTED('Accounts'), [Variance] < 0) ) VAR CumulativeNegativeVariance = CALCULATE( [Variance], FILTER( ALLSELECTED('Accounts'), [Negative Variance Rank] <= [Negative Variance Rank] && [Variance] < 0 ) ) RETURN DIVIDE(CumulativeNegativeVariance, TotalNegativeVariance)Using these cumulative percentage measures, you can now define the categories for your waterfall chart's breakdown. The following Waterfall Category measure checks if an account's variance falls within the top 80% of either the positive or negative cumulative total. If it does, the account's name is returned; otherwise, it is labeled as "Other".
Waterfall Category = IF( OR( [Cumulative Positive Variance %] <= 0.80, [Cumulative Negative Variance %] <= 0.80 ), SELECTEDVALUE('Accounts'[Account]), "Other" )Finally, you need a measure to supply the correct values to the waterfall chart. This measure will provide the standard Variance for individual accounts that are displayed. For the "Other" category, it calculates the sum of variances for all accounts that were grouped together, ensuring the waterfall totals remain accurate.
Waterfall Value = SUMX( SUMMARIZE( 'Accounts', 'Accounts'[Account], "Category", [Waterfall Category], "Value", [Variance] ), IF( [Category] = "Other", CALCULATE( [Variance], FILTER( ALL('Accounts'), NOT(OR([Cumulative Positive Variance %] <= 0.80, [Cumulative Negative Variance %] <= 0.80)) ) ), [Value] ) )To construct the visual in your Power BI report, add a waterfall chart to the canvas. Place your Account field in the "Category" well. Drag the final Waterfall Value measure into the "Values" well. To group the items correctly, you will need to create a supporting column or use advanced filtering based on the Waterfall Category logic to show the individual accounts and the single "Other" bar. A common approach is to create a calculated table for the categories and relate it, but the measure-based logic provided here is often sufficient when combined with appropriate visual-level filters. Ensure the chart is sorted by the Variance measure in descending order to achieve the correct flow from largest to smallest impact.
This fully measure-driven approach is powerful because it is entirely dynamic. Any filter applied to the page, such as for a specific time period or business unit, will trigger a recalculation of all the measures. The ranking, cumulative percentages, and the "Other" group will all adjust automatically, providing a consistently accurate and insightful Pareto analysis of your variance data without any manual intervention.
Best regards,
Hi JST15 ,
Creating a dynamic waterfall chart in Power BI that visualizes the 80/20 Pareto principle for variance analysis is an excellent way to derive deep insights from your financial data. Your initial instinct to use a virtual table is understandable, but a more flexible and robust solution can be achieved by leveraging a series of DAX measures. This measure-based approach ensures your visuals react seamlessly to any slicer or filter applied to the report, providing a truly interactive experience. The strategy is to calculate the variance, rank the positive and negative variances separately, determine their cumulative contribution, and then dynamically group any accounts falling outside the top 80% into an "Other" category directly within the measures that power the chart.
First, you must establish the foundational measures for your actuals, planned amounts, and the variance between them. These form the basis for all subsequent calculations.
Total Actuals = SUM(Actuals[Actual Amount])Total Plan = SUM(Budget[Plan Amount])Variance = [Total Actuals] - [Total Plan]
With the core Variance measure created, the next step is to rank the accounts based on this variance. To handle both favorable and unfavorable variances correctly, you should create two separate ranking measures: one for positive variances, ordered descendingly, and another for negative variances, ordered ascendingly. Using ALLSELECTED is critical here, as it ensures the ranking dynamically adjusts to any active filters on your report page.
Positive Variance Rank =
RANKX(
FILTER( ALLSELECTED('Accounts'), [Variance] > 0 ),
[Variance],
,
DESC
)Negative Variance Rank =
RANKX(
FILTER( ALLSELECTED('Accounts'), [Variance] < 0 ),
[Variance],
,
ASC
)
Now you can calculate the cumulative running total as a percentage of the total variance, which is the heart of the Pareto analysis. These measures will check the rank of the current account and sum up the variance for all accounts with an equal or better rank. This cumulative sum is then divided by the total positive or negative variance, respectively, to get the cumulative percentage.
Cumulative Positive Variance % =
VAR TotalPositiveVariance =
CALCULATE(
[Variance],
FILTER(ALLSELECTED('Accounts'), [Variance] > 0)
)
VAR CumulativePositiveVariance =
CALCULATE(
[Variance],
FILTER(
ALLSELECTED('Accounts'),
[Positive Variance Rank] <= [Positive Variance Rank] && [Variance] > 0
)
)
RETURN
DIVIDE(CumulativePositiveVariance, TotalPositiveVariance)Cumulative Negative Variance % =
VAR TotalNegativeVariance =
CALCULATE(
[Variance],
FILTER(ALLSELECTED('Accounts'), [Variance] < 0)
)
VAR CumulativeNegativeVariance =
CALCULATE(
[Variance],
FILTER(
ALLSELECTED('Accounts'),
[Negative Variance Rank] <= [Negative Variance Rank] && [Variance] < 0
)
)
RETURN
DIVIDE(CumulativeNegativeVariance, TotalNegativeVariance)
Using these cumulative percentage measures, you can now define the categories for your waterfall chart's breakdown. The following Waterfall Category measure checks if an account's variance falls within the top 80% of either the positive or negative cumulative total. If it does, the account's name is returned; otherwise, it is labeled as "Other".
Waterfall Category =
IF(
OR(
[Cumulative Positive Variance %] <= 0.80,
[Cumulative Negative Variance %] <= 0.80
),
SELECTEDVALUE('Accounts'[Account]),
"Other"
)
Finally, you need a measure to supply the correct values to the waterfall chart. This measure will provide the standard Variance for individual accounts that are displayed. For the "Other" category, it calculates the sum of variances for all accounts that were grouped together, ensuring the waterfall totals remain accurate.
Waterfall Value =
SUMX(
SUMMARIZE(
'Accounts',
'Accounts'[Account],
"Category", [Waterfall Category],
"Value", [Variance]
),
IF(
[Category] = "Other",
CALCULATE(
[Variance],
FILTER(
ALL('Accounts'),
NOT(OR([Cumulative Positive Variance %] <= 0.80, [Cumulative Negative Variance %] <= 0.80))
)
),
[Value]
)
)
To construct the visual in your Power BI report, add a waterfall chart to the canvas. Place your Account field in the "Category" well. Drag the final Waterfall Value measure into the "Values" well. To group the items correctly, you will need to create a supporting column or use advanced filtering based on the Waterfall Category logic to show the individual accounts and the single "Other" bar. A common approach is to create a calculated table for the categories and relate it, but the measure-based logic provided here is often sufficient when combined with appropriate visual-level filters. Ensure the chart is sorted by the Variance measure in descending order to achieve the correct flow from largest to smallest impact.
This fully measure-driven approach is powerful because it is entirely dynamic. Any filter applied to the page, such as for a specific time period or business unit, will trigger a recalculation of all the measures. The ranking, cumulative percentages, and the "Other" group will all adjust automatically, providing a consistently accurate and insightful Pareto analysis of your variance data without any manual intervention.
Best regards,
Ahhhhh, this makes sense. Thank you! This is working as expected. I was so stick on needing a virtual table which just wasn't working. Amazing and thank you for all the help!!