Forum Discussion
Creating A Pareto Chart using DAX Function Combinations
Hello All,
Greeting!
While exploring DAX functions, I came across this beautiful demonstration to Create A Pareto Chart In Power BI Using DAX Function Combinations from Enterprise DNA. However, I have failed to replicate the output with my data set. Therefore, looking for assistance.
The measure used for calculating;
1. NoOfOrderLines =
| Days | NoOfOrderLines | Cumulative Total | TotalNoOfLines | Percentage |
| 0 | 6643 | 12220 | ||
| 1 | 597 | 12220 | ||
| 2 | 201 | 12220 | ||
| 3 | 226 | 12220 | ||
| 4 | 291 | 12220 | ||
| 5 | 397 | 12220 | ||
| 6 | 300 | 12220 | ||
| 7 | 306 | 12220 | ||
| 8 | 340 | 12220 | ||
| 9 | 268 | 12220 | ||
| 10 | 236 | 12220 | ||
| 11 | 179 | 12220 | ||
| 12 | 206 | 12220 | ||
| 13 | 171 | 12220 | ||
| 14 | 199 | 12220 | ||
| 15 | 213 | 12220 | ||
| 16 | 141 | 12220 | ||
| 17 | 118 | 12220 | ||
| 18 | 170 | 12220 | ||
| 19 | 143 | 12220 | ||
| 20 | 118 | 12220 | ||
| 21 | 136 | 12220 | ||
| 22 | 114 | 12220 | ||
| 23 | 109 | 12220 | ||
| 24 | 130 | 12220 | ||
| 25 | 88 | 12220 | ||
| 26 | 96 | 12220 | ||
| 27 | 84 | 12220 |
Try adding these two measures:
NoOfOrderLines running total in Days = CALCULATE( SUM('Table'[NoOfOrderLines]), FILTER( ALLSELECTED('Table'[Days]), ISONORAFTER('Table'[Days], MAX('Table'[Days]), DESC) ) )% Calc = DIVIDE([NoOfOrderLines running total in Days], Max('Table'[TotalNoOfLines]))and format the % measure as
Table visual:
Pareto chart visual using Line and stacked column chart
output:
Hope it helps!
I looked into your file and tried to understand some and could not get what is target of 90%.
Providing the details of measures, tune the names and syntax for your needs.
1. Counts Full Consolidation at Origin = VAR FullOrderConsolidation = FILTER( SUMMARIZE('DataTable','DataTable'[Order_ID], 'DataTable'[Delivery_Type]), 'DataTable'[Delivery_Type] = "Full consolidation at origin") Return COUNTROWS(FullOrderConsolidation)1. Counts Ship as Available = VAR ShipAsAvailable = FILTER('DataTable', 'DataTable'[Delivery_Type] = "Ship as available") Return COUNTROWS(ShipAsAvailable)2. No of order lines = [1. Counts Ship as Available] + [1. Counts Full Consolidation at Origin]3. Cumulative Total No of order lines = CALCULATE( [2. No of order lines], FILTER( ALLSELECTED('DataTable'), 'DataTable'[SC_TAT] <= MAx('DataTable'[SC_TAT])))3. Running % CT and Total = DIVIDE( [3. Cumulative Total No of order lines], CALCULATE( [2. No of order lines], ALLSELECTED('DataTable') ), BLANK())Sample output:
Note: You have to check your requirements as SC_TAT going up to 400 values on x-axis, which is not good in my view.
Hope this helps!
10 Replies
- sevenhillsSuper User
Try adding these two measures:
NoOfOrderLines running total in Days = CALCULATE( SUM('Table'[NoOfOrderLines]), FILTER( ALLSELECTED('Table'[Days]), ISONORAFTER('Table'[Days], MAX('Table'[Days]), DESC) ) )% Calc = DIVIDE([NoOfOrderLines running total in Days], Max('Table'[TotalNoOfLines]))and format the % measure as
Table visual:
Pareto chart visual using Line and stacked column chart
output:
Hope it helps!
- JajatiDevHelper II
sevenhills thank you. I appreciate the effort. However, I made a mistake while explaining my requirement due to which the proposed solution isn't giving the desired result. Therefore, I'm providing the raw data to deliver the solution as intended.
The Delivery_Type field is extremely critical while calculating NoOfOrderLines, because
- If, Delivery_Type is "Ship as available" then each so line within the order is treated independently. This implies if an order has 4 lines, then each line is treated separately and will be counted as 4 Order Lines
- If, Delivery_Type is "Full consolidation at origin" then no matter how mail lines are there in the order it will always be counted as 1 Order Line
Due to the above criteria, I create the measure NoOfOrderLines. However, I'm unable to convert this measure into a variable because I'm unsure of the combination of DAX Functions needed to do so.
I require a single measure that would deliver me the Pareto Chart as demonstrated in the video link shared.
Here is the link to the raw data as I'm unable to share in this string.
- sevenhillsSuper User
Unauthorized
Error 401
the file link is unauthorized.
Post some data - copy paste
and also what is the output you are expecting, that way anyone can help.
Looks like you are trying to consolidate orders with availability of sources either use as 1 or multiple. It should be simple calc.
- JajatiDevHelper II
I need to create a Pareto Chart.
Shared below is the measure to calculate NoOfOrderLines.
Using the NoOfOrderLines measure I need assistance with the measure to calculate the cumulative total, percentage and 90% threshold. Table data is shared below as well.
This is the measure for calculating NoOfOrderLines;
NoOfOrderLines =
VAR ShipAsAvailable = FILTER('Table (ClosedOrders)', 'Table (ClosedOrders)'[delivery_type] = "Ship as available")VAR Complete_Table = FILTER(SUMMARIZE('Table (ClosedOrders)','Table (ClosedOrders)'[order_no],'Table (ClosedOrders)'[delivery_type]), 'Table (ClosedOrders)'[delivery_type] = "Full order consolidation")ReturnCOUNTROWS(ShipAsAvailable) + COUNTROWS(Complete_Table)I need assistance with the cumulative total and percentage. I also need to create an intersection of 90%SegmentCustomer_IDOrder_IDItem_NoProduct_IDQuantityPlantDelivery_TypeProduct_GroupSC_TATItem_PriceOrder_Value
Enterprise 1611318663 1111661181 10 4D937BV 1 TX39 Full consolidation at origin CFH11 17 3805.55 30458.08 Enterprise 1611318663 1111661181 200 4D937BV 1 TX39 Full consolidation at origin CFH11 17 3805.55 30458.08 Enterprise 1611318663 1111661181 390 4D937BV 1 TX39 Full consolidation at origin CFH11 17 3805.55 30458.08 Enterprise 1611318663 1111661181 580 4D937BV 1 TX39 Full consolidation at origin CFH11 17 3805.55 30458.08 Enterprise 1611318663 1111661181 770 4D937BV 1 TX39 Full consolidation at origin CFH11 17 3805.55 30458.08 Enterprise 1611318663 1111661181 960 4D937BV 1 TX39 Full consolidation at origin CFH11 17 3805.55 30458.08 Enterprise 1611318663 1111661181 1150 4D937BV 1 TX39 Full consolidation at origin CFH11 17 3805.55 30458.08 Enterprise 1611318663 1111661181 1340 4D937BV 1 TX39 Full consolidation at origin CFH11 17 3805.55 30458.08 Corporate 1511828615 1113431261 10 2F2P2BV 1 TX39 Full consolidation at origin CFH11 333 659.74 659.74 Corporate 1511828615 1113651116 10 2F2P2BV 1 TX39 Full consolidation at origin CFH11 333 659.74 659.74 Corporate 1511828615 1113713254 10 2F2P2BV 1 TX39 Full consolidation at origin CFH11 328 659.74 659.74 Corporate 1511828615 1113757653 10 2D3R6BV 1 TX39 Full consolidation at origin CFH11 325 757.89 757.89 Corporate 1511828615 1113757655 10 2D3R6BV 1 TX39 Full consolidation at origin CFH11 325 757.89 757.89 Corporate 1611285616 1113666321 10 3ST25B-DCH 1 TX39 Ship as available CFH11 314 5547.6 5385.36 Corporate 1611285616 1114126271 10 3ST25B-DCH 1 TX39 Ship as available CFH11 301 5547.6 5578.56 Corporate 1611285616 1114168784 10 3ST25B-DCH 1 TX39 Ship as available CFH11 288 5547.6 5548.56 Corporate 1611285616 1114166163 10 3ST25B-DCH 1 TX39 Ship as available CFH11 309 5547.6 5385.36 Corporate 1611285616 1114236167 10 3ST25B-DCH 2 TX39 Ship as available CFH11 300 8895.8 3799.58 Corporate 1611318663 1114276816 10 3ST25B-DCH 1 TX39 Ship as available CFH11 289 5567.85 5409.85 Corporate 1611318663 1114276816 20 B5K53B 1 TX39 Ship as available C4A11 217 554.65 5409.85 Corporate 1611318663 1114276816 30 V1B53B-DCH 1 TX39 Ship as available C8V11 217 587.35 5409.85 Corporate 1611318663 1114281418 10 3ST25B-DCH 1 TX39 Full consolidation at origin CFH11 289 5567.85 5888.5 Corporate 1611318663 1114281418 20 B5K53B 1 TX39 Full consolidation at origin C4A11 289 554.65 5888.5 Corporate 1611318663 1114412871 10 3ST25B-DCH 1 TX39 Ship as available CFH11 283 5567.85 5409.85 Corporate 1611318663 1114412871 20 B5K53B 1 TX39 Ship as available C4A11 211 554.65 5409.85 Corporate 1611318663 1114412871 30 V1B53B-DCH 1 TX39 Ship as available C8V11 211 587.35 5409.85 Corporate 1611318663 1114412866 10 3ST25B-DCH 1 TX39 Full consolidation at origin CFH11 283 5567.85 5888.5 Corporate 1611318663 1114412866 20 B5K53B 1 TX39 Full consolidation at origin C4A11 283 554.65 5888.5 Corporate 1611285616 1114446662 10 3ST25B-DCH 1 TX39 Ship as available CFH11 281 5547.6 5578.56 Corporate 1611285616 1114462157 10 3ST25B-DCH 1 TX39 Ship as available CFH11 289 5547.6 5653.04 Enterprise 1611318663 1114568135 10 J7Z14B-B2M 1 TX39 Full consolidation at origin C9D11 220 3004.35 3544.04 Enterprise 1611318663 1114568135 20 9UV22B 1 TX39 Full consolidation at origin CGR11 220 499.88 3544.04 Enterprise 1611318663 1114568135 30 2GH31B 1 TX39 Full consolidation at origin C4A11 220 40.45 3544.04 - sevenhillsSuper User
Post the data, DAX and other related info matching ... I am getting few errors and tried to fix as I progress. Let us start using this, a little cleaner version of yours.
Table with data:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("zZZbj9owEIX/CuJ514pnPPb4sYGyqFWlaneLqq72IW1RGwkRBLS/v+Ok3HZp4zi9gESwQfh8Pj4e++Fh+HK5na9X63IzH14NtdUaNVuLoSMvK1+wDp1MHmbs0eWz0JX3/Xv08jH5tlgMPlXLTbUoPxfbsloOiu2gWpdfyqX8PJpMdT2AkwdyRoootDJDrDIePl5FM0B2ARDoLwCC+AIgnLsACG8vAEJrugQKNH+TYlStV9W62NYQJJrAVlMDgQY12H2dgAm8hUQExDAxS145c2i0AlgKVvxHAKcRyPwRAOAkAHKWcA8wxlubDBDGlPEU+0MjDoD+IYAEH5hss+whA7IpYB9CvLsHyq/Ho+kpw93XcjUoNoPie1Euio+L+bGwDo4TGafCoIRMCm2rspHwg+unnOkTZXKsKEbZsmPTRxmYT5VNrLK0sd+cfZLbgNJ2Z5UhVjn8k9mTCpNH572iM2XuSa014Cwfqkya282crUQ6hJxM5kMrXhqCdE6vCfMIWfOika0ru1itbJoqBtWZzkU1csI8O1Zmp7CbMkvEuM3qyILyzHVmCXkHiF+a3gaw8/8nwM7/SH0pLNyvrgBjWt720ol500l526v2yJtOyltQtq1bOzpvT1zvsN72t5s8Om8YmbeTymqMnKHQL29p55ixoOl8Te9YWXfKchlSmWm/QBuSEof7e8sr90Gb/DqHN92M9+OGol45OV9Mkz8kYzpi1CP4dzOAjmt/c3uEYORIq0/2BIJ688HNFHVi+hqCTJkTCx5/AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Segment = _t, Customer_ID = _t, Order_ID = _t, Item_No = _t, Product_ID = _t, Quantity = _t, Plant = _t, Delivery_Type = _t, Product_Group = _t, SC_TAT = _t, Item_Price = _t, Order_Value = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Segment", type text}, {"Customer_ID", Int64.Type}, {"Order_ID", Int64.Type}, {"Item_No", Int64.Type}, {"Product_ID", type text}, {"Quantity", Int64.Type}, {"Plant", type text}, {"Delivery_Type", type text}, {"Product_Group", type text}, {"SC_TAT", Int64.Type}, {"Item_Price", type number}, {"Order_Value", type number}}) in #"Changed Type"Measure "NoOfOrderLines"
NoOfOrderLines = VAR ShipAsAvailable = FILTER('Table', 'Table'[Delivery_Type] = "Ship as available") VAR Complete_Table = FILTER(SUMMARIZE('Table','Table'[Order_ID], 'Table'[Delivery_Type]), 'Table'[Delivery_Type] = "Full consolidation at origin") -- "Full order consolidation" Return COUNTROWS(ShipAsAvailable) + COUNTROWS(Complete_Table)I am getting error when I tried the measure (which I replied and posted based on your original code)...
NoOfOrderLines running total in Days = CALCULATE( 'Table'[NoOfOrderLines], FILTER( ALLSELECTED('Table'[Days]), ISONORAFTER('Table'[Days], MAX('Table'[Days]), DESC) ) )Model view
Can you post what is days here ? I dont see the column here...
- AnonymousNot applicable
Hi JajatiDev ,
Is your problem solved, if it is solved, you can mark the correct answer, if not, you can explain your problem in detail, we can help you better.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.