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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MishiAb
Regular Visitor

Cumulative percentage based on legend in another table

Hiya,

 

Looking for some help with cumulative percentages.

 

I have a mapping table to help with custom sorting my dates (E.g table 1).

 

My actual data sits in a separate table (example snippet below - table 2).

 

I am trying to do a line graph of the cumulative % based on the 'time to delivery' column to figure out how many items were delivered within a set timeframe. I can't use the date feature as the categories are custom.

 

E.g based on the data below:

20% were delivered within a week

40% were delivered within a month

100% were delivered within a year

 

Please can you help provide a measure that will do this?

 

Thank you!

 

Table 1:

 

Date typeOrder
Week1
Month2
6 Month3
Year4

 

Table 2:

 

Date deliveredTime to delivery (days)Speed of completion
21/03/227Week
27/04/2331Month
27/04/23278Year
13/09/2275Year
13/03/2321Month

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @MishiAb 

According to your description, you want to get the  cumulative % based on the 'time to delivery' column to figure out how many items were delivered within a set timeframe.

This is my test data and my undersyand for your need:

vyueyunzhmsft_0-1688699840395.png

We can create a measure like this :

Measure = DIVIDE( SWITCH( MAX('Table1'[Date type]) , 
"Week" , CALCULATE( COUNT('Table2'[Time to delivery]) ,'Table2'[Time to delivery]<=7) ,
"Month",CALCULATE( COUNT('Table2'[Time to delivery]) ,'Table2'[Time to delivery]<=31) ,
"6 Month",CALCULATE( COUNT('Table2'[Time to delivery]) ,'Table2'[Time to delivery]<=186),
"Year" ,CALCULATE( COUNT('Table2'[Time to delivery]) ,'Table2'[Time to delivery]<=366))  ,  COUNT('Table2'[Time to delivery]))

The result is as follows:

vyueyunzhmsft_1-1688700205041.png

 

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi , @MishiAb 

According to your description, you want to get the  cumulative % based on the 'time to delivery' column to figure out how many items were delivered within a set timeframe.

This is my test data and my undersyand for your need:

vyueyunzhmsft_0-1688699840395.png

We can create a measure like this :

Measure = DIVIDE( SWITCH( MAX('Table1'[Date type]) , 
"Week" , CALCULATE( COUNT('Table2'[Time to delivery]) ,'Table2'[Time to delivery]<=7) ,
"Month",CALCULATE( COUNT('Table2'[Time to delivery]) ,'Table2'[Time to delivery]<=31) ,
"6 Month",CALCULATE( COUNT('Table2'[Time to delivery]) ,'Table2'[Time to delivery]<=186),
"Year" ,CALCULATE( COUNT('Table2'[Time to delivery]) ,'Table2'[Time to delivery]<=366))  ,  COUNT('Table2'[Time to delivery]))

The result is as follows:

vyueyunzhmsft_1-1688700205041.png

 

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors