Forum Discussion
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)
Try like
divide(countx(filter(customer,customer[Type]="Membership"),customer[ID])
,calculate(count(customer[ID]),all(customer)))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)
2 Replies
- amitchandakSuper User
Try like
divide(countx(filter(customer,customer[Type]="Membership"),customer[ID])
,calculate(count(customer[ID]),all(customer))) - Greg_DecklerCommunity Champion
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)