Forum Discussion
Count rows based on slicer
Hi ,
I have the following table where I have list of Item.
To calculate weight , i need to count rows of table which is 14 and divide it by 100 as mentioned below.
Also I have a slicer for BLs/subsidiaries , so my count should change bsed on BLs/subsidiaries slicer selection for example for below BLs/subsidiaries as "One" I have total row count as 14 , if i change slicer to another selection my row count also changes.
Can someone help here.Thanks.
| weight =100/14 |
| Total row count =14 |
| Item | Source | BLs/subsidiaries | Weight |
| Asset | Initiatives | One | 7.14285714 |
| Overall | BL | One | 7.14285714 |
| Energy | BL | One | 7.14285714 |
| Availability | BL | One | 7.14285714 |
| RE | Initiatives | One | 7.14285714 |
| Emissions | BL | One | 7.14285714 |
| Conversion | Initiatives | One | 7.14285714 |
| Fuel | BL | One | 7.14285714 |
| Energy | BL | One | 7.14285714 |
| Reliability | Initiatives | One | 7.14285714 |
| 3E’s | Initiatives | One | 7.14285714 |
| Reliability | Initiatives | One | 7.14285714 |
| Thermal | BL | One | 7.14285714 |
| Reliability | Initiatives | One | 7.14285714 |
- Anonymous3 years ago
Hi binayjethwa ,
Actually, there are 14 rows in the table. And 3 duplicated rows not display in the visual, it is by design. You can open my pbix file(the attachment) for the details...
If you also want to display these duplicated rows in the visual, you can add one index column in Power Query Editor. Please find the details in the updated attachment.
Add index column
Toggle off "Text wrap" option
Best Regards
8 Replies
- ribisht17Super User
Hi binayjethwa
Here is my video on ALLSELECTED which should clear the concept below and also it will help you to understand the difference between ALL,ALLEXCEPT AND ALLSELECTED
Regards,
Ritesh
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !! PL 300 Certification Series - lbendlinSuper User
Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?
- binayjethwaHelper V
Hi lbendlin the requirement is simple , I will have a slicer for BLs where i can multi select the values.
Based on my selection i should divide my total count of rows in item column which is 14 in below table and divide by 100 , if i select another BL which has 5 items i should be dividing 100 by 5 which is 20 and that is what my weight would be.
Not if i multi select in slicer , it should take the overall count and not indivitual count of BL. if i select 2 BLs from dopdown and row count is 10 , then weight would be 100/10. Hope this is clear. THanks in advance.
weight =100/14= 7.142857 Total row count in below table =14 Item Source BLs/subsidiaries Weight Asset Initiatives One 7.142857 Overall BL One 7.142857 Energy BL One 7.142857 Availability BL One 7.142857 RE Initiatives One 7.142857 Emissions BL One 7.142857 Conversion Initiatives One 7.142857 Fuel BL One 7.142857 Energy BL One 7.142857 Reliability Initiatives One 7.142857 3E’s Initiatives One 7.142857 Reliability Initiatives One 7.142857 Thermal BL One 7.142857 Reliability Initiatives One 7.142857 - JosephWuFrequent Visitor
Hi , binayjethwa
I create a measure like this:
Because there are many same items name(Reliabilty、Energy), the table only show 11 item not 14.
So,you will see the number is 7.14.
If you want to change the measure,just change the "CountRow()" to "Distinctcount()"I guess you will get the right answer.
Regards,
Joseph
- AnonymousNot applicable
Hi binayjethwa ,
I created a sample pbix file(see the attachment), please check if that is what you want. You can create a measure as below to get it:
Weight = VAR _value = 100 VAR _count = CALCULATE ( COUNT ( 'Table'[Item] ), ALLSELECTED ( 'Table' ) ) RETURN _value / _countBest Regards
- binayjethwaHelper V
Hi Anonymous in the screenshot you shared i see there are 11 rows , hence weight should be 100/11 = 9.09 and not 7.41.
- AnonymousNot applicable
Hi binayjethwa ,
Actually, there are 14 rows in the table. And 3 duplicated rows not display in the visual, it is by design. You can open my pbix file(the attachment) for the details...
If you also want to display these duplicated rows in the visual, you can add one index column in Power Query Editor. Please find the details in the updated attachment.
Add index column
Toggle off "Text wrap" option
Best Regards
- binayjethwaHelper V
Anonymous This is working as Expected. Thank you