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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Forrester
New Member

dax fixed count

Hello,

 

I am trying to get a fixed count for accounts under a customer so that I can apply 1 of 2 billing models (measure A for customers with 1 account, measure B for customers with >1 account).

 

Table  Results I'm Trying to achieve
CustomerAccount #ofAccountsMeasure to Use
11 2---use measure B
12 2---use measure B
21 1---use measure A
31 1---use meaure A
41 4---use meaure B
42 4---use meaure B
43 4---use meaure B
44 4---use meaure B
51 1---use meaure A
61 2---use meaure B
62 2---use meaure B

 

Problems:

Calculated Column Method:

If i create the #ofAccounts as a calculated column I am struggling to pull it into the billing measure:

Example: Billing:=IF([#ofAccounts]>1,[Measure B],[Measure A]) --Problem I cant refence {#ofAccounts) because its not reference customer

 

Measure Method:

#ofAccounts:=CALCULATE(DISTINCTCOUNT(Data[AccountId]))

This works if just looking at the measure, if I filter on customer 1 it returns a value of 2. However, when i try to apply the billing measure --Billing:=IF([#ofAccounts]>1,[Measure B],[Measure A])

it just reads off the account column and treats everything as a 1.

 

Thanks

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Forrester,

Problems:

Calculated Column Method:

If i create the #ofAccounts as a calculated column I am struggling to pull it into the billing measure:

Example: Billing:=IF([#ofAccounts]>1,[Measure B],[Measure A]) --Problem I cant refence {#ofAccounts) because its not reference customer 

 

Maybe you could try this formula:

Billing=IF(MAX([#ofAccounts])>1,[Measure B],[Measure A])

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @Forrester,

Problems:

Calculated Column Method:

If i create the #ofAccounts as a calculated column I am struggling to pull it into the billing measure:

Example: Billing:=IF([#ofAccounts]>1,[Measure B],[Measure A]) --Problem I cant refence {#ofAccounts) because its not reference customer 

 

Maybe you could try this formula:

Billing=IF(MAX([#ofAccounts])>1,[Measure B],[Measure A])

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Need source data sample/example. 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

 


@ 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...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.