Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
LucaBr
New Member

Pareto Dax Formula, dynamic and filtered

Hi all, 
i do have to create a Pareto graph divided on the X by the Root problem and on the Y by cost.
the dataframe that i have is something like this:

Data PeriodORGCostCommentActionRootvalue
1/2/2024org1100root1root1root10
1/3/2024org1814root1root1root10
1/4/2024org1814root1root1root10
1/5/2024org1814root1root1root10
1/6/2024org15559root1root1root10
1/7/2024org15559root1root1root10
1/8/2024org15559root1root1root10
1/2/2024org2100root1root1root10
1/3/2024org2100root1root1root10
1/4/2024org2100root1root1root10
1/5/2024org2100root1root1root10
1/6/2024org2550root1root1root10
1/7/2024org2550root1root1root10
1/8/2024org2550root1root1root10
1/6/2024org3651root2root2root20
1/2/2024org41797root1root1root10
1/3/2024org41289root1root1root10
1/4/2024org41562root1root1root10
1/5/2024org4765root1root1root10
1/6/2024org41009root1root1root10
1/7/2024org41009root1root1root10
1/8/2024org41009root1root1root10
1/8/2024org5120root3root3root30
1/8/2024org5150root3root3root30


i do have some filter on year, month, org
for this purpose i did create a dax formula like this:

CumulativePercentage =
var CumulativeCost =
CALCULATE(
SUM(COST[cost]),
FILTER(
ALLSELECTED(COST),
COST[cost] >= MAX(COST[cost])
)
)
VAR TotalCost =
CALCULATE(
SUMCOST[cost]),
FILTER(
ALLSELECTED(COST) ,
COST[cost] = (COST[cost])

)
)

RETURN
DIVIDE(CumulativeCost,TotalCost,0)

 

 


the problem of the formula in this way is due to the org, for different org there are the same cc and when i place this "COST[cost] >= MAX(COST[cost])" in the filter it take the highest record and does not sum the rest, so the pareto is not perfect.
how can i create the comulative for pareto considerign also this particular problem?

If you need any more information please do not hesitate to ask

1 ACCEPTED SOLUTION
BeaBF
Super User
Super User

@LucaBr Hi! Try with:

 

CumulativePercentage =
VAR TotalCost = CALCULATE(SUM(COST[Cost]), ALLSELECTED(COST))
VAR CurrentRoot = COST[Root]

VAR CostByRoot =
CALCULATE(
SUM(COST[Cost]),
FILTER(
ALLSELECTED(COST),
COST[Root] = CurrentRoot
)
)

VAR CumulativeCost =
CALCULATE(
SUM(COST[Cost]),
FILTER(
ALLSELECTED(COST),
COST[Root] <= CurrentRoot
)
)

RETURN
DIVIDE(CumulativeCost, TotalCost, 0)

 

BBF

View solution in original post

7 REPLIES 7
sio2Graphs
Helper I
Helper I

Hello, 

 

You can use visual "Pareto+" to create a graph and table or "Pareto by sio2Graphs" to produce the graph, if you don’t want to bother with formulas.

 

sio2Graphs 😀

sio2graphs on AppSource 

 

Screenshot 2024-11-08 130712.png

Hi, i did try that but in the moment i do apply the filter, it does not work anymore

Hi.

 

   You don't have to use a measure for the cost.

 

Screenshot 2024-11-11 121110.png

BeaBF
Super User
Super User

@LucaBr Hi! Try with:

 

CumulativePercentage =
VAR TotalCost = CALCULATE(SUM(COST[Cost]), ALLSELECTED(COST))
VAR CurrentRoot = COST[Root]

VAR CostByRoot =
CALCULATE(
SUM(COST[Cost]),
FILTER(
ALLSELECTED(COST),
COST[Root] = CurrentRoot
)
)

VAR CumulativeCost =
CALCULATE(
SUM(COST[Cost]),
FILTER(
ALLSELECTED(COST),
COST[Root] <= CurrentRoot
)
)

RETURN
DIVIDE(CumulativeCost, TotalCost, 0)

 

BBF

WOW, you are amazing!!
i hust have this one problem:  VAR CurrentRoot = COST[Root] does give me an error:
"

A single value for column 'Root Cause' in table 'LAYER2_COST_VARIANCE_COMMENTS_C3' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
"

i did substitute with VAR CurrentRoot = SELECTEDVALUE(COST[Root]) 
but for the rest is working!!!

@LucaBrYou are right! You did it right!

 

BBF

hi i think i did find out a small problem

LucaBr_0-1731317282448.png

basically the comulative does follow the root cause alphabetical order, but i would like to follow the cost varaince.

 

is the problem due to this "COST[Root] <= CurrentRoot" ?

in this case the cv for COSTING is 200 
test scenario is 20
test is 5


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.