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 August 31st. Request your voucher.

Reply
laurelning
Helper I
Helper I

How to create a new measure of % by group

Hi all,

    I am new to DAX and I believe this is a very simple question to the experts here. I have a survey question that asks customer to respond why they frequent a certain store and they can check multiple reasons. I have two data sets, one having the customer IDs and the reason; the other data file having again customer IDs and the stores they visited.  If, for example, we have a total of 10 customers, among them, 8 check location... how to get the percentage based on a total of 10 customers? Please see below the excel table that I would like to create instead in power bi.

why.png

The sample data is here to download :

https://drive.google.com/open?id=19NYmpV0ulE_Hhla0pCZFFcpFB56mXmI7

 

Thanks in advance and your help is highly appreciated!

 

Laurel

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Here's the full and correct solution. The answer does not lie in DAX. It lies in the data model.

 

https://1drv.ms/u/s!ApyQEauTSLtOgYM53H8bs_VEwonrUA?e=1mhVYz

 

Best

D

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

Sure,

 

Measure = DIVIDE(COUNTROWS('Sheet1'),COUNTROWS(DISTINCT(ALL(Sheet2[Customer ID]))),0)

 

PBIX is attached. 



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

Thanks for helping out. I look forward to learning from your book. Maybe I haven't explained clear enough in the first post. The exact excel table I look for in power bi is :

why3excel.png

And the measure created gives me the following:

why2.png

I hope to have the percentage of reasons by stores. 

 

Thanks.

 

Laurel

Anonymous
Not applicable

Here's the full and correct solution. The answer does not lie in DAX. It lies in the data model.

 

https://1drv.ms/u/s!ApyQEauTSLtOgYM53H8bs_VEwonrUA?e=1mhVYz

 

Best

D

@Anonymous  Thanks! It works and serves the purpose. I was ablto to follow your example and replicate it to my very complex data. There is still a place that doesn't come back to be right though. Also I am wondering if there is way that we can make it work simpler. Will come back to you with more questions. Thanks again for your time!

 

Great to have the community here to support!

 

Ling

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.