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

Assign accounts to Household

Let's say I have the following data:

- 10 Total Account numbers (row records), have one product type of Phone or Internet

- 5 Unique Households (say they're called "Household 1"..."Household 5")

- Each Household (HH) has 2 Accounts

- A HH can be classified as "Double Phone" = 2x Phones,  "Double Internet" = 2x Internet, or "Mix" = 1x of each 

 

So, how do I assign that HH classification to each account?

 

And ideally, that new field (assignment) could be used for grouping purposes and I could study that group.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HH = 
VAR varPhone = CALCULATE(COUNTROWS('Data'),FILTER(ALLEXCEPT('Data','Data'[Household]),'Data'[Product] = "Phone"))
VAR varInternet = CALCULATE(COUNTROWS('Data'),FILTER(ALLEXCEPT('Data','Data'[Household]),'Data'[Product] = "Internet"))
RETURN
    IF( varPhone > 0, IF(varInternet >0, "Mix", "Phone"),"Internet")

You can try the above. And add this code as a calculated column to your table.  It will give you the following result.

 

2019-07-17_22h05_34.png

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HH = 
VAR varPhone = CALCULATE(COUNTROWS('Data'),FILTER(ALLEXCEPT('Data','Data'[Household]),'Data'[Product] = "Phone"))
VAR varInternet = CALCULATE(COUNTROWS('Data'),FILTER(ALLEXCEPT('Data','Data'[Household]),'Data'[Product] = "Internet"))
RETURN
    IF( varPhone > 0, IF(varInternet >0, "Mix", "Phone"),"Internet")

You can try the above. And add this code as a calculated column to your table.  It will give you the following result.

 

2019-07-17_22h05_34.png

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.

Top Solution Authors