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
El_Bastien
Frequent Visitor

Pareto Diagram

Hello! I'm running into some issues trying to create a Pareto Diagram. 

 

I've created this DAX formula to create the Cumulative Count of my variables. When I wanted to check if the formula was running as it should, I saw this:

Screenshot 2024-10-10 at 12.21.54 p.m..png


As shown in the picture above, the line from the second to the third bar automatically adds up to 130 automatically, even though it should be 115 and then 130 when calculating the cumulative with the 4th bar.

This is the DAX code I've used.

 

Pareto =

IF(
ISINSCOPE('Data for PBI'[Question 1 Answers]),
VAR __AllSelectedAns = ALLSELECTED('Data for PBI'[Question 1 Answers])
VAR __AnsTable = ADDCOLUMNS(__AllSelectedAns, "Count",[Q1 Total Count])
VAR __CurrentCount1 = [Q1 Total Count]
VAR __CumQ1Table = FILTER(__AnsTable, [Count] >= __CurrentCount1)
VAR __CumQ1 = SUMX(__CumQ1Table, [Count])
RETURN
__CumQ1
)

Do you have any ideas on how to solve this?

If you have an idea on how to run a DAX code for the % for the Pareto Diagram, that would be very useful too!

Thank you!

3 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

You need a tie breaker. Add a small random number to each of the values.

View solution in original post

v-xuxinyi-msft
Community Support
Community Support

Hi @El_Bastien 

 

Thanks for the reply from lbendlin.

 

The following testing is for your reference.

 

My sample:

vxuxinyimsft_0-1728616613826.png

 

Create two measures as follow:

 

Your [Q1 Total Count] looks like a measure, and since I don't know its calculation logic, I created [Q1 Total Count1] to restore your scene, and in your scene, you can use [Q1 Total Count] directly.

 

Pareto = 
VAR _AllSelectedAns = 
    ALLSELECTED('Data for PBI'[Question 1 Answers])
VAR _CurrentCount1 = 
    [Q1 Total Count1]
VAR _CumQ1Table = 
    FILTER(
        _AllSelectedAns,
        [Q1 Total Count1] <= _CurrentCount1
    )
VAR _CumQ1 = 
    SUMX(
        _CumQ1Table, 
        [Q1 Total Count1]
    )
RETURN
IF(
    ISINSCOPE('Data for PBI'[Question 1 Answers]),
    _CumQ1
)

 

 

Pareto % = 
VAR _TotalCount = 
    CALCULATE(
        SUM('Data for PBI'[Q1 Total Count]),
        ALL('Data for PBI'[Question 1 Answers])
    )
VAR _CumulativeCount = [Pareto]
RETURN
DIVIDE(_CumulativeCount, _TotalCount, 0)

 

Output:

vxuxinyimsft_0-1729243981641.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

sio2Graphs
Helper I
Helper I

Hello, 

 

You can use visual "Pareto+" to create a graph and table.  The visual with do all of the calculations for you.  You can also use "Pareto by sio2Graphs" to produce the graph, no need for measures.

 

😀

sio2Graphs

sio2graphs on AppSource 

Data on Git

 

graph and table.png

 

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
sio2Graphs
Helper I
Helper I

Hello, 

 

You can use visual "Pareto+" to create a graph and table.  The visual with do all of the calculations for you.  You can also use "Pareto by sio2Graphs" to produce the graph, no need for measures.

 

😀

sio2Graphs

sio2graphs on AppSource 

Data on Git

 

graph and table.png

 

v-xuxinyi-msft
Community Support
Community Support

Hi @El_Bastien 

 

Thanks for the reply from lbendlin.

 

The following testing is for your reference.

 

My sample:

vxuxinyimsft_0-1728616613826.png

 

Create two measures as follow:

 

Your [Q1 Total Count] looks like a measure, and since I don't know its calculation logic, I created [Q1 Total Count1] to restore your scene, and in your scene, you can use [Q1 Total Count] directly.

 

Pareto = 
VAR _AllSelectedAns = 
    ALLSELECTED('Data for PBI'[Question 1 Answers])
VAR _CurrentCount1 = 
    [Q1 Total Count1]
VAR _CumQ1Table = 
    FILTER(
        _AllSelectedAns,
        [Q1 Total Count1] <= _CurrentCount1
    )
VAR _CumQ1 = 
    SUMX(
        _CumQ1Table, 
        [Q1 Total Count1]
    )
RETURN
IF(
    ISINSCOPE('Data for PBI'[Question 1 Answers]),
    _CumQ1
)

 

 

Pareto % = 
VAR _TotalCount = 
    CALCULATE(
        SUM('Data for PBI'[Q1 Total Count]),
        ALL('Data for PBI'[Question 1 Answers])
    )
VAR _CumulativeCount = [Pareto]
RETURN
DIVIDE(_CumulativeCount, _TotalCount, 0)

 

Output:

vxuxinyimsft_0-1729243981641.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

You need a tie breaker. Add a small random number to each of the values.

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.