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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tomperro
Helper III
Helper III

Formula to calculate total and percentage

Hello, 

I am trying to get a count of tests a supervisor has done per day and also show what percentage that count if of the supervisors total.  I know this can be done using a table matrix and selecting Percent of Row Total but I need to get a roll up count for anything over 50%. 


Example:

Toms testing: total of 449 tests

Day of WeekTotal TestsPercentage of Total
Monday 6614.7%
Tuesday9721.6%
Wednesday 13429.8%
Thursday6113.5%
Friday9120.2%

 

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

Hi @tomperro ,

According to your sharing sample, I think you want to get the count of total test based on the filter condition. Based on this understanding, here are my test process

To achieve your goal, you can follow these steps:

The data you provided seem that cannot meet the condition, here are my test data

vheqmsft_0-1701329729757.png

1.Create a measure by using DAX  to calculate the percentage of total

 

Percentage of total = DIVIDE(
    SUM('Table2'[Total Test]),
    CALCULATE(
        SUM('Table2'[Total Test]),
        ALL('Table2'[Day of Week])
    )
)

 

2.Create another measure to get the count of rows

 

Measure = 
var a=[Percentage of total]
var tab=SUMMARIZE('Table2','Table2'[Day of Week],"@percent",a)
return COUNTROWS(FILTER(tab,[@percent]>0.5))

 

3.Create the final >50%  total count measure

 

>50%  total count = SUMX(VALUES('Table2'[Day of Week]),[Measure])

 

4.Final output

vheqmsft_1-1701329896461.png

I hope my solution can help you, but if it doesn’t, you can always share your thoughts and feedback with me by posting a comment below this post.

In order for you to solve the problem faster, you can refer to the following documentation

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

Best Regards,

Albert He 

View solution in original post

1 REPLY 1
v-heq-msft
Community Support
Community Support

Hi @tomperro ,

According to your sharing sample, I think you want to get the count of total test based on the filter condition. Based on this understanding, here are my test process

To achieve your goal, you can follow these steps:

The data you provided seem that cannot meet the condition, here are my test data

vheqmsft_0-1701329729757.png

1.Create a measure by using DAX  to calculate the percentage of total

 

Percentage of total = DIVIDE(
    SUM('Table2'[Total Test]),
    CALCULATE(
        SUM('Table2'[Total Test]),
        ALL('Table2'[Day of Week])
    )
)

 

2.Create another measure to get the count of rows

 

Measure = 
var a=[Percentage of total]
var tab=SUMMARIZE('Table2','Table2'[Day of Week],"@percent",a)
return COUNTROWS(FILTER(tab,[@percent]>0.5))

 

3.Create the final >50%  total count measure

 

>50%  total count = SUMX(VALUES('Table2'[Day of Week]),[Measure])

 

4.Final output

vheqmsft_1-1701329896461.png

I hope my solution can help you, but if it doesn’t, you can always share your thoughts and feedback with me by posting a comment below this post.

In order for you to solve the problem faster, you can refer to the following documentation

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

Best Regards,

Albert He 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.