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

Count Distinct values based on another calculate column

Hello
I am new with power BI and I need help to perform a calculation.
For each worker I have the number of transactions (Trx Equivalent) that he made by date and time range and the goal he should have reached.

 

ID_EMP

DATE

HOUR

TRX

GOAL

123

01/01/2017

7

38

38

123

01/01/2017

8

33

38

123

01/01/2017

9

37

38

123

02/01/2017

7

39

38

123

02/01/2017

8

41

38

123

03/01/2017

7

38

38

874

01/01/2017

7

30

38

874

01/01/2017

8

37

38

874

01/01/2017

9

41

38

874

02/01/2017

7

43

38

874

02/01/2017

8

40

38

333

01/01/2017

7

44

38

333

01/01/2017

8

47

38

333

03/01/2017

7

45

38

333

03/01/2017

8

40

38

645

01/01/2017

7

37

38

645

01/01/2017

8

37

38

645

02/01/2017

7

37

38

645

03/01/2017

7

45

38

 

 

I have a calculation that tells me if it meets expectations or not


PROD = if (SUM ('Table' [TRX]) / SUM ('Table' [GOAL])> 1; 1; SUM ('Table' [TRX]) / SUM ('Table' [GOAL]))


I have several tables and filters that show me the data in different levels of opening.


Now, I want to count the amount of different ID_EMPs in which PROD is> = 1. For example:


In this case, considering all dates, the count is 2

 

ID_EMP

Sum TRX

Sum GOAL

PROD

123

226

228

99%

333

176

152

100%

645

150

152

99%

874

191

190

100%

 

In this case, filtering the date and leaving only 01/01/2017, the count is 1

 

ID_EMP

Sum TRX

Sum GOAL

PROD

123

108

114

95%

333

91

76

100%

645

72

76

95%

874

108

114

95%

 

How to do that count?

 

Thanks!

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@ebravo45

 

Give this a try

 

Measure =
COUNTX ( FILTER ( ALLSELECTED ( Table1[ID_Emp] ), [PROD] = 1 ), 1 )

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@ebravo45

 

Give this a try

 

Measure =
COUNTX ( FILTER ( ALLSELECTED ( Table1[ID_Emp] ), [PROD] = 1 ), 1 )

Regards
Zubair

Please try my custom visuals

Wonderful. It works perfect. Thank you! Smiley Very Happy

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.