cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bcbuckley13
Helper III
Helper III

How to calculate a % of stores that have two different codes

Hi PBI Community...TIA !!

 

I have a report (TEST A) that gives me a list of restaurants and two different deviations. (x and y). I'm trying to do the calculation for when a restaurant has both. When I run this code, the result is too high. Any ideas?

 

% of restaurants with glove AND mask deviation = DIVIDE(CALCULATE(count('TEST A'[Store ID]),'TEST A'[Code] = "x") + CALCULATE(count('TEST A'[Store ID]),
'TEST A'[Code] = "y"),count('TEST B'[Store ID]))
 
 
1 REPLY 1
mhossain
Super User I
Super User I

Hi @bcbuckley13 

 

Try this % of restaurants with glove AND mask deviation =
DIVIDE(
CALCULATE(count('TEST A'[Store ID]),'TEST A'[Code] = "x"||'TEST A'[Code] = "y"),
count('TEST B'[Store ID]))

 

In the Test A table do you have duplicate enteries?Do you want to count duplicate or disctinct? Please adjust above dax accordingly. Please let me know if this works.

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors