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
Anonymous
Not applicable

Calculation (dividing a number that includes a filter by the total number)

Hi,

 

I've recently just started using PowerBI as our company has adopted it. I don't have much coding experience but oustide of the coding aspect I've became very familiar with the tool as I've been using it. I'm trying to write a calculation or measure that counts the number of total responses if they are a certain number and divide that number over the total number of responses. An example would be that we have customer satisfaction surveys and let's just say it's a 1-5 scale with 1 being the lowest and 5 being the highest. Let's say 10 total submissions came in and 5 of those were rated under 3 and the other 5 were rated 4 and above. We only consider 4s and 5s as satisified. That would give us a total of 5 submissions that were 4 or 5. and considered "satisfied". The calculation I'm looking for would say count the number of satisified submissions which is a total of 5 (we're only counting 4s and 5s as satisfied) and divide that by the total number of submissions which is 10. How would that formula look? I've tried looking around online but I haven't found a scenario that's close to mine to reference. Thanks in advance for any help. 

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

hi, @Anonymous

Assume this is the basic data

8.JPG

Then we can create a measure by DAX Function DIVIDE like this

 

Measure = 
DIVIDE (
    CALCULATE (
        COUNTA ( 'Table'[Sub ID] ),
        FILTER ( 'Table', 'Table'[Score] >= 4 )
    ),
    CALCULATE ( COUNTA ( 'Table'[Sub ID] ) )
)

Then darg it into visual

 

9.JPG

 

 

CALCULATE (
COUNTA ( 'Table'[Sub ID] ),
FILTER ( 'Table', 'Table'[Score] >= 4 )

 

is calculate count Sub ID whicn satisfied >=4

you could also use this formula

CALCULATE (
COUNTA ( 'Table'[Sub ID] ),
FILTER ( 'Table', 'Table'[Score] = 4 || 'Table'[Score] = 5)

 and 

CALCULATE ( COUNTA ( 'Table'[Sub ID] ) )

is calculate Count(all the Sub ID)

 

 

By the way, if you don't have much coding experience and are not familiar with DAX Function, 

I suggest you to learn DAX and familiar with POWER BI first.

https://docs.microsoft.com/en-us/power-bi/desktop-what-is-desktop

 

Best Regards,
Lin

 

 

Community Support Team _ Lin
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-lili6-msft
Community Support
Community Support

hi, @Anonymous

Assume this is the basic data

8.JPG

Then we can create a measure by DAX Function DIVIDE like this

 

Measure = 
DIVIDE (
    CALCULATE (
        COUNTA ( 'Table'[Sub ID] ),
        FILTER ( 'Table', 'Table'[Score] >= 4 )
    ),
    CALCULATE ( COUNTA ( 'Table'[Sub ID] ) )
)

Then darg it into visual

 

9.JPG

 

 

CALCULATE (
COUNTA ( 'Table'[Sub ID] ),
FILTER ( 'Table', 'Table'[Score] >= 4 )

 

is calculate count Sub ID whicn satisfied >=4

you could also use this formula

CALCULATE (
COUNTA ( 'Table'[Sub ID] ),
FILTER ( 'Table', 'Table'[Score] = 4 || 'Table'[Score] = 5)

 and 

CALCULATE ( COUNTA ( 'Table'[Sub ID] ) )

is calculate Count(all the Sub ID)

 

 

By the way, if you don't have much coding experience and are not familiar with DAX Function, 

I suggest you to learn DAX and familiar with POWER BI first.

https://docs.microsoft.com/en-us/power-bi/desktop-what-is-desktop

 

Best Regards,
Lin

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.