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
po
Post Prodigy
Post Prodigy

Number of distinct customers with median of certain value

Hi,

Wish to calculate the following

Percentage of Shops which hit target which varies dynamically depending on w/edate and store name which selected in slicers

 

Data

 Shop, W/E date, target met

 

target met is derived in table and can set correctly at table level to 0 depeidning on store percentage above 70, target met is set to 1

 

e.g

 

A, 05/01/2019,0

A,12/01/2019,0

A,19/01/2019,1

B, 05/01/2019,0

B,12/01/2019,1

B,19/01/2019,1

C, 05/01/2019,1

C,12/01/2019,1

C,19/01/2019,1

 

i.e. in above if looked at all this median OF A is 0, b is 1 and c is 1 i.e. 66% met target i.e 2 out of 3 stores met target. 

However if were just looking at 19/01/2019 all met target i.e. would be 100%.


How can we best achieve this in power bi?

 

Thanks

1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @po,

Based on my test, you could refer to below measure:

Measure = CALCULATE(COUNT(Table1[target]),FILTER('Table1','Table1'[target]<>0))/COUNT(Table1[target])

Result:

1.PNG

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
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-danhe-msft
Employee
Employee

Hi @po,

Based on my test, you could refer to below measure:

Measure = CALCULATE(COUNT(Table1[target]),FILTER('Table1','Table1'[target]<>0))/COUNT(Table1[target])

Result:

1.PNG

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

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

Thanks for reply and .pbix file

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.