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
Anonymous
Not applicable

Dax Formula for Division

Hi,

 

I have Total customers =500 and Customer_Type are ordinary(200) and  Membership(300). i want to write a formula for sales ration which is

 

Total Customer (500)/ only memebership(300)=60% is my sales ration

 

As my customer type how i can define in formula like Sales ration= (Total Customers/ value where customer_type="membership)

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

Try like


divide(countx(filter(customer,customer[Type]="Membership"),customer[ID])
,calculate(count(customer[ID]),all(customer)))

View solution in original post

Greg_Deckler
Super User
Super User

Sample data would make this quesiton much more clear. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

That being said, you might try something like:

Sales Ratio =
  VAR __TotalCustomers = COUNTROWS(ALL('Customers'))
  VAR __MemberCustomers = COUNTROWS(FILTER(ALL('Customers'),[Customer_Type]="membership"))
RETURN
  DIVIDE(__MemberCustomers,__TotalCustomers,0)

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

Sample data would make this quesiton much more clear. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

That being said, you might try something like:

Sales Ratio =
  VAR __TotalCustomers = COUNTROWS(ALL('Customers'))
  VAR __MemberCustomers = COUNTROWS(FILTER(ALL('Customers'),[Customer_Type]="membership"))
RETURN
  DIVIDE(__MemberCustomers,__TotalCustomers,0)

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

Try like


divide(countx(filter(customer,customer[Type]="Membership"),customer[ID])
,calculate(count(customer[ID]),all(customer)))

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.