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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
dataanalyst2023
Frequent Visitor

Count of multiple values in the same column

Good afternoon, I am needing some help figuring out how to calculate the top 3 values answered in a survey. 

 

Ex the question says as follow: Select your top 3 colors (out of a list of 10 they can only select 3)

Answers: purple; white; blue

               white; yellow; blue

               yellow; pink; black

 

in my report I want the visual to display the top 3 colors mentioned. In this case, White-2, Blue-2, Yellow- 2

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@dataanalyst2023 If you split that column based on ";" and then unpivot those columns this is a cake walk.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
v-xinruzhu-msft
Community Support
Community Support

Hi,

Thanks for the solution @Greg_Deckler  offered, it is excellent,   and i want to offer user another solution by using dax to refer to.

and i want to offer some more information for user to refer to.

hello @dataanalyst2023 , you can also use dax , you can refer it.

Sample data 

Color table:

vxinruzhumsft_0-1722479401821.png

Answer table

vxinruzhumsft_1-1722479426609.png

You can create a measure 

Measure = COUNTROWS(FILTER('Answer',CONTAINSSTRING([Answers],MAX(Color[Color]))))

Then put the color field and the measure to the table visual, and in visual field, set the following filters:

vxinruzhumsft_2-1722479507815.png

 

Output

vxinruzhumsft_3-1722479516063.png

 

Best Regards!

Yolo Zhu

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

 

 

Thank you both for all your help. I would rather use DAX withing the same table to not have to create a second source as splitting it will duplicate my responses if I don't create a second source. But @Greg_Deckler solution did give me the answers I want to display.

 

@v-xinruzhu-msft  using the solution you offered it does work but I still get all 3 in the same cell and not separate. 

This is my column 

dataanalyst2023_0-1722522391057.png

The visual gives me the top 3 answers with all 3 colors in the same cell. 

Greg_Deckler
Super User
Super User

@dataanalyst2023 If you split that column based on ";" and then unpivot those columns this is a cake walk.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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