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.
I have a survay data. I need to find the positive %. So in the Positive column we will be counting the total 1. and that count should be divided by total distinct dount of ID. and for 2021 i have to use the FILTER
now the formula is Positive%= calculate(count (Positive)/distinct count(ID),filter (Year =2021).
Now the ussue is that if ant of the employee if his positive is coming as 0 then their ID is not counting. I need the distinct count of all ID irresoective of Positive 1 0r 0. how can i do that. below is the sample.
ID | Name | Attri | Positive | Negative | year |
12 | James | Helath | 1 | 1 | 2021 |
12 | James | Pay | 0 | 2 | 2021 |
12 | James | Transport | 1 | 1 | 2021 |
13 | Rex | Helath | 0 | 2 | 2021 |
13 | Rex | Pay | 1 | 1 | 2021 |
13 | Rex | Transport | 0 | 2 | 2021 |
14 | Sam | Helath | 0 | 1 | 2021 |
14 | Sam | Pay | 0 | 2 | 2021 |
14 | Sam | Transport | 0 | 3 | 2021 |
12 | James | Helath | 0 | 1 | 2020 |
12 | James | Pay | 0 | 2 | 2020 |
12 | James | Transport | 0 | 1 | 2020 |
13 | Rex | Helath | 0 | 2 | 2020 |
13 | Rex | Pay | 1 | 1 | 2020 |
13 | Rex | Transport | 0 | 2 | 2020 |
14 | Sam | Helath | 0 | 1 | 2020 |
14 | Sam | Pay | 0 | 2 | 2020 |
14 | Sam | Transport | 0 | 3 | 2020 |
Solved! Go to Solution.
Measure =
VAR __Table = FILTER('Table',[year]=2021)
VAR __Denominator = COUNTROWS(DISTINCT(SELECTCOLUMNS(__Table,"ID",[ID])))
VAR __Numerator = COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER(__Table,[Positive]=1),"ID",[ID])))
RETURN
DIVIDE(__Numerator,__Denominator,0)
@unnijoy Try:
@unnijoy Seems like:
COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER('Table',[year]=2021),"ID",[ID])))
hi @Greg_Deckler ,
thanks for the qucik reply. can i need the filter in over all. Like = count (positive)/dist(ID),filter 2021. How can i achive this
hi @Greg_Deckler , as per the above table the expected result is as follows.
positive = 2
total dist count of id = 3. as u can see that the for the third guy positive is coming as 0 but still we need to count him.
Positive % = 2/3= 67 %
Measure =
VAR __Table = FILTER('Table',[year]=2021)
VAR __Denominator = COUNTROWS(DISTINCT(SELECTCOLUMNS(__Table,"ID",[ID])))
VAR __Numerator = COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER(__Table,[Positive]=1),"ID",[ID])))
RETURN
DIVIDE(__Numerator,__Denominator,0)
@unnijoy Try:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
145 | |
108 | |
107 | |
89 | |
61 |