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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Memorable Member
Memorable Member

@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
Memorable Member
Memorable Member

@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!!!

BeaBF
Memorable Member
Memorable Member

@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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.