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
slackerhx
Helper II
Helper II

Revising existing measure to be more dynamic

Hi All, 

 

I'm getting stuck in creating a more dynamic version of the following formula. 

 

I'm using the following measure as a filter on a map to identify which cities where 2 companies are present. 

 

Two clients in city = if(CALCULATE(DISTINCTCOUNT('Table 1'[Client Name]),values('Table 1'[City]),or('Table 1'[Client Name]="ABC",'Table 1'[Client Name]="XYZ"))=2,"Yes","No")
 
The measure works fine but it is not dynamic enough as I have to specify the names of the company in the measure and adjust the number of companies i need to look at accordingly (highlighted in RED). 
 
Is there any suggestion how to create a more dynamic version of this calculation where user can use a filter to select the names of the company and the number of companies present in the same city? 
 
Thank you. 
1 ACCEPTED SOLUTION
slackerhx
Helper II
Helper II

I manage to find the answer to my question above: 
 
if(CALCULATE(DISTINCTCOUNT('Table 1'[Client Name]),values('Table 1'[City]),ALLSELECTED('Table 1'[Client Name]))>1,"Yes","No")

View solution in original post

1 REPLY 1
slackerhx
Helper II
Helper II

I manage to find the answer to my question above: 
 
if(CALCULATE(DISTINCTCOUNT('Table 1'[Client Name]),values('Table 1'[City]),ALLSELECTED('Table 1'[Client Name]))>1,"Yes","No")

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.