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
WLFRD
Helper III
Helper III

Sum with filter for percentage of total

Hello,

 

I'm struggling with this. I want to know the percentage of parts that fall within five days of the difference between the enter date and the stock date. This must be a percentage of the total number. If there is no stock date yet, it may not be included in the calculation.

 

This is my data:

Enter_dateStock_dateDays
18-Feb-2221-Feb-223
18-Feb-2221-Feb-223
18-Feb-2222-Feb-224
18-Feb-2222-Feb-224
17-Feb-2217-Feb-220
17-Feb-2217-Feb-220
17-Feb-2217-Feb-220
17-Feb-2221-Feb-224
17-Feb-2228-Feb-2211
17-Feb-2217-Feb-220
17-Feb-2217-Feb-220
17-Feb-2217-Feb-220
17-Feb-2222-Feb-225
17-Feb-2217-Feb-220
17-Feb-2223-Feb-226
17-Feb-2222-Feb-225
17-Feb-2218-Feb-221
17-Feb-2217-Feb-220
17-Feb-2222-Feb-225
17-Feb-2228-Feb-2211
17-Feb-2228-Feb-2211
17-Feb-2223-Feb-226
17-Feb-2217-Feb-220
17-Feb-2217-Feb-220
17-Feb-2228-Feb-2211
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2221-Feb-224
17-Feb-2221-Feb-224
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2224-Feb-227
17-Feb-2223-Feb-226
17-Feb-2222-Feb-225
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2223-Feb-226
17-Feb-2218-Feb-221
17-Feb-2221-Feb-224
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2225-Feb-228
17-Feb-2223-Feb-226
17-Feb-2217-Feb-220
17-Feb-2218-Feb-221
17-Feb-2221-Feb-224
17-Feb-2222-Feb-225
17-Feb-2222-Feb-225
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2218-Feb-221
17-Feb-2225-Feb-228
16-Feb-2216-Feb-220
16-Feb-2224-Feb-228
16-Feb-2217-Feb-221

 

Capture.JPG

 

In this example, the number of lines is 60. The question is, what is the percentage of the total of the days that fall between 0 and 5 days?

There are 60 days in the example and 47 days are between 0 and 5 days. The percentage I'm looking for is (47/60)*100= 78.33%.

Those 60 lines can also be 1000 or 10000. That can differ per day when we run these reports.

 

Can someone help me out?

 

Thanks!

 

Regards

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @WLFRD 

 

You can try the following methods.

Measure:

Percentage = 
Var _1=CALCULATE(COUNT('Table'[Days]),FILTER('Table',[Days]<=5&&[Days]>=0))
Var _2=COUNT('Table'[Days])
Return
DIVIDE(_1,_2)

vzhangti_0-1647238735092.png

Is this the result you were expecting?

 

Best Regards,

Community Support Team _Charlotte

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-zhangti
Community Support
Community Support

Hi, @WLFRD 

 

You can try the following methods.

Measure:

Percentage = 
Var _1=CALCULATE(COUNT('Table'[Days]),FILTER('Table',[Days]<=5&&[Days]>=0))
Var _2=COUNT('Table'[Days])
Return
DIVIDE(_1,_2)

vzhangti_0-1647238735092.png

Is this the result you were expecting?

 

Best Regards,

Community Support Team _Charlotte

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.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.