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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Boopep
Helper I
Helper I

Request for Assistance in computing the formula

I want  to get a result based on the survey result.

Using this formula:

Number of 'Strongly Agree'(5) + Number of 'Agree' (4)

Divided by

Number of Respondents - Number of 'N/A' (0)

 

1. I want to get the result of SQD0

2. I want to get the result of SQD 1-8

3. I want to get the result of per office of SQD0 and SQD 1-8

 

OFFICESTART_SURVEY_DATESTART_DATEEND_DATECC1CC2CC3SQD0SQD1SQD2SQD3SQD4SQD5SQD6SQD7SQD8
Norte LHIO07/31/202407/31/202407/31/2024443444444444
Norte LHIO05/20/202403/06/202403/06/2024311444444444
Norte LHIO03/08/202402/05/202402/05/2024311444444444
Norte LHIO11/07/202407/11/202407/11/2024322444400444
Albay LHIO05/08/202403/06/202403/06/2024454414012141
Albay LHIO07/01/202402/07/202402/07/2024111444444444
Albay LHIO08/09/202409/08/202409/08/2024222444444444
Albay LHIO10/10/202410/10/202410/10/2024443000000000
Albay LHIO10/28/202410/28/202410/28/2024443414040411
Albay LHIO11/14/202411/14/202411/14/2024222444444444
Albay LHIO12/03/202403/12/202403/12/2024331444440411
Camarines 06/21/202406/21/202406/21/2024454114411444
Camarines 02/12/202502/19/202502/19/2025111444444444
Camarines 12/19/202412/19/202412/19/2024443444440444
Camarines 07/25/202407/25/202407/25/2024111444440444
Camarines 07/31/202407/31/202407/31/2024111444440444

 

Help is very much appreciated.

Thank you in advance

1 ACCEPTED SOLUTION
Boopep
Helper I
Helper I

After reading and trial and error i think i got it correct
Self pat on the back!
 
Measure SQD1-8 =
VAR Very_Satisfactory =
SUMX(
    'Sample',
    IF('Sample'[SQD1] = 5, 1, 0) +
    IF('Sample'[SQD2] = 5, 1, 0) +
    IF('Sample'[SQD3] = 5, 1, 0) +
    IF('Sample'[SQD4] = 5, 1, 0) +
    IF('Sample'[SQD5] = 5, 1, 0) +
    IF('Sample'[SQD6] = 5, 1, 0) +
    IF('Sample'[SQD7] = 5, 1, 0) +
    IF('Sample'[SQD8] = 5, 1, 0)
)

VAR Satisfactory =
SUMX(
    'Sample',
    IF('Sample'[SQD1] = 4, 1, 0) +
    IF('Sample'[SQD2] = 4, 1, 0) +
    IF('Sample'[SQD3] = 4, 1, 0) +
    IF('Sample'[SQD4] = 4, 1, 0) +
    IF('Sample'[SQD5] = 4, 1, 0) +
    IF('Sample'[SQD6] = 4, 1, 0) +
    IF('Sample'[SQD7] = 4, 1, 0) +
    IF('Sample'[SQD8] = 4, 1, 0)
)

VAR NA_Count =
    SUMX(
    'Sample',
    IF('Sample'[SQD1] = 0, 1, 0) +
    IF('Sample'[SQD2] = 0, 1, 0) +
    IF('Sample'[SQD3] = 0, 1, 0) +
    IF('Sample'[SQD4] = 0, 1, 0) +
    IF('Sample'[SQD5] = 0, 1, 0) +
    IF('Sample'[SQD6] = 0, 1, 0) +
    IF('Sample'[SQD7] = 0, 1, 0) +
    IF('Sample'[SQD8] = 0, 1, 0)
)

VAR TotalRespondents = COUNTROWS('Sample')  

RETURN
(Very_Satisfactory + Satisfactory) / ((TotalRespondents*8)- NA_Count)

View solution in original post

3 REPLIES 3
Boopep
Helper I
Helper I

After reading and trial and error i think i got it correct
Self pat on the back!
 
Measure SQD1-8 =
VAR Very_Satisfactory =
SUMX(
    'Sample',
    IF('Sample'[SQD1] = 5, 1, 0) +
    IF('Sample'[SQD2] = 5, 1, 0) +
    IF('Sample'[SQD3] = 5, 1, 0) +
    IF('Sample'[SQD4] = 5, 1, 0) +
    IF('Sample'[SQD5] = 5, 1, 0) +
    IF('Sample'[SQD6] = 5, 1, 0) +
    IF('Sample'[SQD7] = 5, 1, 0) +
    IF('Sample'[SQD8] = 5, 1, 0)
)

VAR Satisfactory =
SUMX(
    'Sample',
    IF('Sample'[SQD1] = 4, 1, 0) +
    IF('Sample'[SQD2] = 4, 1, 0) +
    IF('Sample'[SQD3] = 4, 1, 0) +
    IF('Sample'[SQD4] = 4, 1, 0) +
    IF('Sample'[SQD5] = 4, 1, 0) +
    IF('Sample'[SQD6] = 4, 1, 0) +
    IF('Sample'[SQD7] = 4, 1, 0) +
    IF('Sample'[SQD8] = 4, 1, 0)
)

VAR NA_Count =
    SUMX(
    'Sample',
    IF('Sample'[SQD1] = 0, 1, 0) +
    IF('Sample'[SQD2] = 0, 1, 0) +
    IF('Sample'[SQD3] = 0, 1, 0) +
    IF('Sample'[SQD4] = 0, 1, 0) +
    IF('Sample'[SQD5] = 0, 1, 0) +
    IF('Sample'[SQD6] = 0, 1, 0) +
    IF('Sample'[SQD7] = 0, 1, 0) +
    IF('Sample'[SQD8] = 0, 1, 0)
)

VAR TotalRespondents = COUNTROWS('Sample')  

RETURN
(Very_Satisfactory + Satisfactory) / ((TotalRespondents*8)- NA_Count)
bhanu_gautam
Super User
Super User

@Boopep , Create measures for this

Measure for SQD0:

SQD0_Result =
VAR StronglyAgree = CALCULATE(COUNTROWS('Table'), 'Table'[SQD0] = 5)
VAR Agree = CALCULATE(COUNTROWS('Table'), 'Table'[SQD0] = 4)
VAR TotalRespondents = COUNTROWS('Table')
VAR NA_Count = CALCULATE(COUNTROWS('Table'), 'Table'[SQD0] = 0)
RETURN
(StronglyAgree + Agree) / (TotalRespondents - NA_Count)

 

Measure for SQD1-8:

SQD1_8_Result =
VAR StronglyAgree = CALCULATE(COUNTROWS('Table'), 'Table'[SQD1] = 5 || 'Table'[SQD2] = 5 || 'Table'[SQD3] = 5 || 'Table'[SQD4] = 5 || 'Table'[SQD5] = 5 || 'Table'[SQD6] = 5 || 'Table'[SQD7] = 5 || 'Table'[SQD8] = 5)
VAR Agree = CALCULATE(COUNTROWS('Table'), 'Table'[SQD1] = 4 || 'Table'[SQD2] = 4 || 'Table'[SQD3] = 4 || 'Table'[SQD4] = 4 || 'Table'[SQD5] = 4 || 'Table'[SQD6] = 4 || 'Table'[SQD7] = 4 || 'Table'[SQD8] = 4)
VAR TotalRespondents = COUNTROWS('Table')
VAR NA_Count = CALCULATE(COUNTROWS('Table'), 'Table'[SQD1] = 0 || 'Table'[SQD2] = 0 || 'Table'[SQD3] = 0 || 'Table'[SQD4] = 0 || 'Table'[SQD5] = 0 || 'Table'[SQD6] = 0 || 'Table'[SQD7] = 0 || 'Table'[SQD8] = 0)
RETURN
(StronglyAgree + Agree) / (TotalRespondents - NA_Count)

 

Measure for SQD0 and SQD1-8 per Office:

DAX
SQD0_Per_Office =
VAR StronglyAgree = CALCULATE(COUNTROWS('Table'), 'Table'[SQD0] = 5, ALLEXCEPT('Table', 'Table'[OFFICE]))
VAR Agree = CALCULATE(COUNTROWS('Table'), 'Table'[SQD0] = 4, ALLEXCEPT('Table', 'Table'[OFFICE]))
VAR TotalRespondents = CALCULATE(COUNTROWS('Table'), ALLEXCEPT('Table', 'Table'[OFFICE]))
VAR NA_Count = CALCULATE(COUNTROWS('Table'), 'Table'[SQD0] = 0, ALLEXCEPT('Table', 'Table'[OFFICE]))
RETURN
(StronglyAgree + Agree) / (TotalRespondents - NA_Count)

 

DAX
SQD1_8_Per_Office =
VAR StronglyAgree = CALCULATE(COUNTROWS('Table'), ('Table'[SQD1] = 5 || 'Table'[SQD2] = 5 || 'Table'[SQD3] = 5 || 'Table'[SQD4] = 5 || 'Table'[SQD5] = 5 || 'Table'[SQD6] = 5 || 'Table'[SQD7] = 5 || 'Table'[SQD8] = 5), ALLEXCEPT('Table', 'Table'[OFFICE]))
VAR Agree = CALCULATE(COUNTROWS('Table'), ('Table'[SQD1] = 4 || 'Table'[SQD2] = 4 || 'Table'[SQD3] = 4 || 'Table'[SQD4] = 4 || 'Table'[SQD5] = 4 || 'Table'[SQD6] = 4 || 'Table'[SQD7] = 4 || 'Table'[SQD8] = 4), ALLEXCEPT('Table', 'Table'[OFFICE]))
VAR TotalRespondents = CALCULATE(COUNTROWS('Table'), ALLEXCEPT('Table', 'Table'[OFFICE]))
VAR NA_Count = CALCULATE(COUNTROWS('Table'), ('Table'[SQD1] = 0 || 'Table'[SQD2] = 0 || 'Table'[SQD3] = 0 || 'Table'[SQD4] = 0 || 'Table'[SQD5] = 0 || 'Table'[SQD6] = 0 || 'Table'[SQD7] = 0 || 'Table'[SQD8] = 0), ALLEXCEPT('Table', 'Table'[OFFICE]))
RETURN
(StronglyAgree + Agree) / (TotalRespondents - NA_Count)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






In Measure for SQD1-8: 

how do i make that all the fields in SQD1-8 are being counted not just the rows

110 should be the total respondent for this query

Boopep_0-1744363289109.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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