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
jcastr02
Post Prodigy
Post Prodigy

sentiment count over total surveys

I'd like to be able to create a measure showing the number of positive response divided by total number of rows.  In example below should have about 55%  (14/23).   I thought of creating another column and putting if "positive", then 1, if not 0, then taking average, but figured there may be a simpler approach.  Thanks.  

 

sentiment.png

1 ACCEPTED SOLUTION

Hi @jcastr02 ,

 

Here we go.

Measure = 
VAR po =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', 'Table'[Sentiment] = "Positive" )
    )
VAR countrall =
    CALCULATE ( COUNTROWS ( 'Table' ), ALL ( 'Table' ) )
RETURN
    DIVIDE ( po, countrall )

Capture.PNG

 

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

View solution in original post

7 REPLIES 7
v-frfei-msft
Community Support
Community Support

Hi @jcastr02 ,

 

In your scenario, a measure like that can help you.

Measure =
VAR Technician =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            'Table',
            'Table'[what is yuour role] IN { "Technician", "Pharmacist" }
        )
    )
RETURN
    DIVIDE ( Technician, COUNTROWS ( 'Table' ) )

Capture.PNG

 

Pbix as attached.

 

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

Woops, I attached the wrong screen shot.  I apologize @zoloturu @v-frfei-msft sentiment.png

looking for number of positives / total rows  @v-frfei-msft @zoloturu 

Hi @jcastr02 ,

 

Here we go.

Measure = 
VAR po =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', 'Table'[Sentiment] = "Positive" )
    )
VAR countrall =
    CALCULATE ( COUNTROWS ( 'Table' ), ALL ( 'Table' ) )
RETURN
    DIVIDE ( po, countrall )

Capture.PNG

 

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

@v-frfei-msft   

 

How could I get it based on what filters are used, for example, when I filter for Location - "Miami" I see 26% , because its taking into account all surveys, not what is filtered by.   I should see 75% , so 6/8 are positives from Miami.   How can we alter the DAX?  Thanks so much. Miami.png

zoloturu
Memorable Member
Memorable Member

@jcastr02 ,

 

Which method do you use to identify if the value in a column is positive? 


Regards,
Ruslan Zolotukhin (zoloturu)
BI Engineer at Akvelon Inc. / Kharkiv Power BI User Group Leader / DAX & Power BI Trainer
-------------------------------------------------------------------
You are from Ukraine? If yes then welcome to Power BI User Group - KhPUG website. Other country? Check and find proper one - Power BI User Groups

@zoloturu I don't use anything - This is calculated by microsoft Forms and just gives me responses based on text sentiment, I would just need to know the % of positives over total amount of surveys (rows)

 

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.