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
RooneyHat
Frequent Visitor

Count Multiple Choice Text field occurrences from Multiple Columns.

Hi Everyone,

 

Apologies if this has been answered before, I'm new to PowerBi and I haven't been able to find a solution.

I have a SharePoint list and am attempting to count every text occurrence (20+ options) from multiple columns. This is filtered by year and quarter column: '2021 Q2'.

 Objective Choice 1Objective Choice 2Objective Choice 3Objective Choice 4Objective Choice 5
Person AOrangenullBlueBlueGreen
Person BnullnullOrangeOrangeOrange
Person CBlueGreenYellowYellowOrange
Person DGreenOrangeYellowGreennull

 

The goal is to get the count of all text fields that match, there are over 20 possible options:
Orange = 6

Blue = 3

Green = 4

etc.


Thanks in advance for any help/direction!

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

Hi  @RooneyHat ,

You could try the following steps:

Step 1,create a slicer table:

v-luwang-msft_0-1618455380460.png

Step 2,use the following measure on base table:

sum = 
CALCULATE (
    COUNT ( 'Table'[Objective Choice 1] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Objective Choice 1] = SELECTEDVALUE ( Slicer[Color] )
    )
)
    + CALCULATE (
        COUNT ( 'Table'[Objective Choice 2] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Objective Choice 2] = SELECTEDVALUE ( Slicer[Color] )
        )
    )
    + CALCULATE (
        COUNT ( 'Table'[Objective Choice 3] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Objective Choice 3] = SELECTEDVALUE ( Slicer[Color] )
        )
    )
    + CALCULATE (
        COUNT ( 'Table'[Objective Choice 4] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Objective Choice 4] = SELECTEDVALUE ( Slicer[Color] )
        )
    )
    + CALCULATE (
        COUNT ( 'Table'[Objective Choice 5] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Objective Choice 5] = SELECTEDVALUE ( Slicer[Color] )
        )
    )

Then create visualization:

v-luwang-msft_1-1618455471549.png

 

You could download my pbix file to learn more details,wish it is helpful for you!

 

Best Regards

Lucien

View solution in original post

3 REPLIES 3
v-luwang-msft
Community Support
Community Support

Hi  @RooneyHat ,

You could try the following steps:

Step 1,create a slicer table:

v-luwang-msft_0-1618455380460.png

Step 2,use the following measure on base table:

sum = 
CALCULATE (
    COUNT ( 'Table'[Objective Choice 1] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Objective Choice 1] = SELECTEDVALUE ( Slicer[Color] )
    )
)
    + CALCULATE (
        COUNT ( 'Table'[Objective Choice 2] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Objective Choice 2] = SELECTEDVALUE ( Slicer[Color] )
        )
    )
    + CALCULATE (
        COUNT ( 'Table'[Objective Choice 3] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Objective Choice 3] = SELECTEDVALUE ( Slicer[Color] )
        )
    )
    + CALCULATE (
        COUNT ( 'Table'[Objective Choice 4] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Objective Choice 4] = SELECTEDVALUE ( Slicer[Color] )
        )
    )
    + CALCULATE (
        COUNT ( 'Table'[Objective Choice 5] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Objective Choice 5] = SELECTEDVALUE ( Slicer[Color] )
        )
    )

Then create visualization:

v-luwang-msft_1-1618455471549.png

 

You could download my pbix file to learn more details,wish it is helpful for you!

 

Best Regards

Lucien

Thanks this helped!

RooneyHat
Frequent Visitor

Guess this is more complicated than I thought 🙂

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.