cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ce2016 Frequent Visitor
Frequent Visitor

Pareto Chart with multiple aggregation levels

Dear all,

 

I am trying to create a pareto chart that allows me to visualize the amount of deliveries categorized by different codes, whereas I am able to switch on slicer filter from year, to months, to calendar week.

 

The data source is one huge excel file with data on very granular level.

 

So far I succeeded in getting a correct ranking, which is neccessary to cumulate the numbers.

 

However, only the cumulation on the most granular level is correct and I think it has something to do with this ALLEXPECT function. If I remove let's say Calendar Week (Calendar Year/Week) from the ALLEXPECT statement then the cumulation on monthly level is correct, but overall year and weekly is incorrect.

 

Do you have any ideas how I could fix the code?

DC Analysis is the name of the table, Delivery Code labels the respective delivery (direct, indirect, express,...)

 

 

Ranking = RANKX(ALL('DC Analysis'[Delivery Code]);
			CALCULATE(SUM('DC Analysis'[Amount of Deliveries]);
			ALLEXCEPT('DC Analysis';'DC Analysis'[Delivery Code];'DC Analysis'[Calendar Year/Month];'DC Analysis'[Calendar Year/Week])
							);;DESC)


Cumulative Total = CALCULATE(
SUM('DC Analysis'[Amount of Deliveries]);
FILTER(ALLSELECTED('DC Analysis');
[Ranking]<= MAXX('DC Analysis';[Ranking])
))

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-huizhn-msft
Microsoft

Re: Pareto Chart with multiple aggregation levels

Hi @ce2016,

After check in details, I get expected results eventually. The "MAXX('Sample',[RankingSample])" in your formula is wrong, you can create another measure to test, I create another measure named "Test max of RankingSample", it should returen the max value utill current rows, while it returns wrong result, so please correct using VAR in DAX, like [current max Measure] measure, then you can use it in your cumulative total measure.

1.PNG

Test max of RankingSample = MAXX('Sample',[RankingSample])
current max Measure = VAR rr=[RankingSample]
RETURN(rr)


Then change your formula as follows,

New Cumulative TotalSample = VAR rr=[RankingSample]
RETURN( CALCULATE(
	SUM('Sample'[Amount of Deliveries]),
	FILTER(ALLSELECTED('Sample'),
		[RankingSample]<= rr
	)))

Cumulated Percentage = [New Cumulative TotalSample]/[Total per DC]


Now when you can get expected result whether the filter is set on month or week.

3.PNGfilter on month4.PNGfilter on week

Please download the attachment to check more details.

Best Regards,
Angelia

View solution in original post

7 REPLIES 7
Microsoft v-huizhn-msft
Microsoft

Re: Pareto Chart with multiple aggregation levels

Hi @ce2016,

I think you should rank all your rows based on each day. Use the Calendar Year/Day in ALLEXCEPT statement, and check if it works fine.

In addition, do you SUM('DC Analysis'[Amount of Deliveries]) in ranking calculated column? Could you please share your sample table model with dummy data for further analysis.

Best Regards,
Angelia

ce2016 Frequent Visitor
Frequent Visitor

Re: Pareto Chart with multiple aggregation levels

Hey Angelina @v-huizhn-msft, thanks for helping me out.

 

I put the Calendar Year / Day in the Allexpect ranking and removed all other ones but now the ranking is all wrong.

SUM('DC Analysis'[Amount of Deliveries]) is done as a measure. As column I did get a wrong ranking.

 

This is what the underlying table looks like (this is just an excerpt)

 

Calendar Year/MonthCalendar Year/WeekActual delivery dateDelivery CodeCust.Hier.:Level 3Cust.Hier.:Level 4Cust.Hier.:Level 5Amount of Delivery
09.201739.201725.09.2017ABL3 Customer AL4 Customer AL5 Customer A15555
09.201739.201725.09.2017CDL3 Customer AL4 Customer AL5 Customer A6000
09.201739.201725.09.2017EFL3Customer BL4 Customer BL5 Customer B54666
09.201739.201725.09.2017GHL3 Customer AL4 Customer AL5 Customer A8036
09.201739.201725.09.2017CAL3 Customer BL4 Customer BL5 Customer A7110
09.201739.201725.09.2017ABL3 Customer AL4 Customer AL5 Customer A5022
09.201739.201725.09.2017ABL3 Customer AL4 Customer AL5 Customer A200
09.201739.201725.09.2017DDL3 Customer AL4 Customer BL5 Customer B300
09.201739.201725.09.2017CDL3 Customer CL4 Customer CL5 Customer C400
09.201739.201726.09.2017EFL3 Customer AL4 Customer AL5 Customer A1152
09.201739.201727.09.2017CAL3 Customer AL4 Customer AL5 Customer A1152

 

This what the graph and figures look like if the ALLEXCPECT statement includes the items Delivery Code, Calendar Year/Monthly and Calendar Year/Weekly, whereas the filter is set on a specific week.

 

Weekly.PNG

 

 

This what the graph and figures look like with the same ALLEXCPECT statement when the filter is set on a month.

 

Monthly.PNG

 

 

 

Microsoft v-huizhn-msft
Microsoft

Re: Pareto Chart with multiple aggregation levels

Hi @ce2016,

Do you mind share your .pbix file for further analysis? It's hard to find the specific reason by the screenshot you shared.

Best Regards,
Angelia

ce2016 Frequent Visitor
Frequent Visitor

Re: Pareto Chart with multiple aggregation levels

Hey Angelina,

 

I uploaded a sample pbix. file on dropbox:

 

https://www.dropbox.com/s/kpdoqlrtc32egnt/Pareto%20Chart%20Sample.pbix?dl=0

 

Thank you for your great support!

Microsoft v-huizhn-msft
Microsoft

Re: Pareto Chart with multiple aggregation levels

Hi @ce2016,

After check in details, I get expected results eventually. The "MAXX('Sample',[RankingSample])" in your formula is wrong, you can create another measure to test, I create another measure named "Test max of RankingSample", it should returen the max value utill current rows, while it returns wrong result, so please correct using VAR in DAX, like [current max Measure] measure, then you can use it in your cumulative total measure.

1.PNG

Test max of RankingSample = MAXX('Sample',[RankingSample])
current max Measure = VAR rr=[RankingSample]
RETURN(rr)


Then change your formula as follows,

New Cumulative TotalSample = VAR rr=[RankingSample]
RETURN( CALCULATE(
	SUM('Sample'[Amount of Deliveries]),
	FILTER(ALLSELECTED('Sample'),
		[RankingSample]<= rr
	)))

Cumulated Percentage = [New Cumulative TotalSample]/[Total per DC]


Now when you can get expected result whether the filter is set on month or week.

3.PNGfilter on month4.PNGfilter on week

Please download the attachment to check more details.

Best Regards,
Angelia

View solution in original post

Highlighted
ce2016 Frequent Visitor
Frequent Visitor

Re: Pareto Chart with multiple aggregation levels

Hi Angelina @v-huizhn-msft, I just noticed that the cumulated amount of deliveries is not correct if I remove the filters or select on monthly level. Only when the filters are set on a specific calendar week, the values are correct...Can you check again please?

 

 

rcyber Regular Visitor
Regular Visitor

Re: Pareto Chart with multiple aggregation levels

Hi all!

 

I'm trying to create the similar report.

I put formulas as Angelina wrote above.

But I have strange results.

Cumulative total amount is wrong. I don't understand why it happens.

 

2018-03-09_11-39-25.png

 

My pbix file is here: link

Can anybody help me?

 

Thanks in advance,

Alex.

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)