Forum Discussion
Jagriti11
5 years agoNew Member
Counting Rows basis of two columns
I have data like below
| Vendor code | Duplicate basis of Bank account | Duplicate basis of name | Duplicate basis of Address |
| Vendor A | 1 | 1 | 1 |
| Vendor B | 1 | 1 | 0 |
| Vendor C | 1 | 0 | 0 |
| Vendor D | 0 | 0 | 1 |
| Vendor E | 1 | 0 | 1 |
I am trying to create table visual as below but I am stuck for the vendor where more than one condition is true.
| KPIs | Count | Percentage |
| Count of duplicate vendor basis on Bank account | 4 | 80% |
| Count of duplicate vendor basis on name | 2 | 40% |
| Count of duplicate vendor Address | 3 | 60% |
Above table is just illustration of real table.
Can any one help????
Hi Jagriti11 ,
Unpivot the columns excluding the vendor code and then create two measures for Percentage and Vendor Count as shown below:Vendor Count = CALCULATE(DISTINCTCOUNTNOBLANK(Data[Vendor code]),Data[Count]=1)Percentage % = DIVIDE([Vendor Count],CALCULATE([Vendor Count],ALL(Data[Flag])),BLANK())This will give you desired result:
Please accept this as a solution if you question has been answeredAppreciate a Kudos 😀
1 Reply
- jaideepnemaSolution Sage
Hi Jagriti11 ,
Unpivot the columns excluding the vendor code and then create two measures for Percentage and Vendor Count as shown below:Vendor Count = CALCULATE(DISTINCTCOUNTNOBLANK(Data[Vendor code]),Data[Count]=1)Percentage % = DIVIDE([Vendor Count],CALCULATE([Vendor Count],ALL(Data[Flag])),BLANK())This will give you desired result:
Please accept this as a solution if you question has been answeredAppreciate a Kudos 😀