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
Kev_G
Regular Visitor

I need help to display sorted accounts in a table that has unique values

Hi, I would like to ask for help in Power Bi to evaluate a column. Please see below sample

 

AccountDeployment
Company1    WFH
Company1    Office
Company2    WFH
Company3    Office
Company 4WFH
Company 5Office

 

I'd like to create a table that I can use for the Slicer Visual:

1. Showing the accounts that have WFH Deployment only

2. Showing the accounts that have Office Deployment only

3. Showing the accounts that have both Office and WFH deployment

Thank you!

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Kev_G ;

You could create a flag measure.

1.create a table as slicer.

slicer = VALUES('Table'[Deployment])

2.create a flag measure.

flag = 
var _contain=SUMMARIZE(FILTER(ALL('Table'),[Deployment] in ALLSELECTED('slicer'[Deployment])),[Account])
var _not=SUMMARIZE(FILTER(ALL('Table'),NOT( [Deployment]) in ALLSELECTED('slicer'[Deployment])),[Account])
return IF( ISFILTERED(slicer[Deployment]),
         IF(
           DISTINCTCOUNT(slicer[Deployment])=CALCULATE(DISTINCTCOUNT(slicer[Deployment]),ALL(slicer)),
            IF(CALCULATE(DISTINCTCOUNT('Table'[Deployment]),ALLEXCEPT('Table','Table'[Account]))=DISTINCTCOUNT(slicer[Deployment]),1,0), 
             IF(MAX('Table'[Account]) in EXCEPT( _contain ,_not),1,0)),1)

3.apply it into filter.

vyalanwumsft_0-1645496576046.png

The final output is shown below:

vyalanwumsft_1-1645496600743.png  vyalanwumsft_2-1645496606409.png vyalanwumsft_3-1645496612147.png

 

 


Best Regards,
Community Support Team_ Yalan Wu
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-yalanwu-msft
Community Support
Community Support

Hi, @Kev_G ;

You could create a flag measure.

1.create a table as slicer.

slicer = VALUES('Table'[Deployment])

2.create a flag measure.

flag = 
var _contain=SUMMARIZE(FILTER(ALL('Table'),[Deployment] in ALLSELECTED('slicer'[Deployment])),[Account])
var _not=SUMMARIZE(FILTER(ALL('Table'),NOT( [Deployment]) in ALLSELECTED('slicer'[Deployment])),[Account])
return IF( ISFILTERED(slicer[Deployment]),
         IF(
           DISTINCTCOUNT(slicer[Deployment])=CALCULATE(DISTINCTCOUNT(slicer[Deployment]),ALL(slicer)),
            IF(CALCULATE(DISTINCTCOUNT('Table'[Deployment]),ALLEXCEPT('Table','Table'[Account]))=DISTINCTCOUNT(slicer[Deployment]),1,0), 
             IF(MAX('Table'[Account]) in EXCEPT( _contain ,_not),1,0)),1)

3.apply it into filter.

vyalanwumsft_0-1645496576046.png

The final output is shown below:

vyalanwumsft_1-1645496600743.png  vyalanwumsft_2-1645496606409.png vyalanwumsft_3-1645496612147.png

 

 


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

tamerj1
Super User
Super User

Hi @Kev_G 

Easier to start with adding a new calculated column to you existing table (Accounts Table). 

Number Of Deployments=

COUNTROWS (
FILTER ( Accounts, Accounts[Account] = EARLIER ( Accounts[Account] ) )
)

 

Then create your tables 

Table 1 =
FILTER (
Accounts,
Accounts[Deployment] = "WFH"
&& Accounts[Number Of Deployments] = 1
)

 

Table 2 =
FILTER (
Accounts,
Accounts[Deployment] = "Office"
&& Accounts[Number Of Deployments] = 1
)

 

Table 3 =
FILTER (
Accounts,
Accounts[Number Of Deployments] = 2
)

 

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