Forum Discussion
Help needed regarding Nested Filter in Power BI
I am looking for help with nested filtering in Power BI and below is my situation,
I have a country column and Device name column in my dataset. I want to first filter out the countries having greater than 10 devices count and among these filtered countries, I want to then filter out bottom 20 countries which should be dynamic and should be affected with the slicers placed.
- Anonymous1 year ago
Hi, AbhishekAejae
Thanks for rajendraongole1 reply. You can try the following measure to achieve your need.Counts = VAR __countsCountry = CALCULATE ( COUNT ( 'Table'[Country] ), ALLEXCEPT ( 'Table', 'Table'[Country] ) ) RETURN __countsCountry Flag = IF ( [Counts] > 3, 1 ) Rank = VAR __rank = RANKX ( FILTER ( ALLSELECTED ( 'Table' ), [Flag] = 1 ), [Counts],, ASC, DENSE ) RETURN __rank
Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
4 Replies
- rajendraongole1Super User
Hi AbhishekAejae - Can you please share some sample data in excel copy, it helps to analyse further.
- AbhishekAejaeRegular Visitor
Hi rajendraongole1 - Below is the Sample data for my scenario in which I have 17 countries and devices assigned to them respectively. For eg: Switzerland has 37 device count and similarly I want to filter all countries having greater than 10 device count and again filter bottom 5 countries from the first filtered countries.
Device Name Country PHINHY-L78000 Switzerland PHINHY-L78001 Belgium PHINHY-L78002 Switzerland PHINHY-L78003 Austria PHINHY-L78004 Slovenia PHINHY-L78005 Switzerland PHINHY-L78006 Slovenia PHINHY-L78007 Slovenia PHINHY-L78008 Austria PHINHY-L78009 Switzerland PHINHY-L78010 Switzerland PHINHY-L78011 Slovenia PHINHY-L78012 Austria PHINHY-L78013 Germany PHINHY-L78014 Belgium PHINHY-L78015 Switzerland PHINHY-L78016 Switzerland PHINHY-L78017 Uzbekistan PHINHY-L78018 Switzerland PHINHY-L78019 Switzerland PHINHY-L78020 Switzerland PHINHY-L78021 Uzbekistan PHINHY-L78022 Switzerland PHINHY-L78023 Poland PHINHY-L78024 Austria PHINHY-L78025 Switzerland PHINHY-L78026 Switzerland PHINHY-L78027 Uzbekistan PHINHY-L78028 Uzbekistan PHINHY-L78029 Uzbekistan PHINHY-L78030 Uzbekistan PHINHY-L78031 Switzerland PHINHY-L78032 Uzbekistan PHINHY-L78033 Switzerland PHINHY-L78034 Uzbekistan PHINHY-L78035 Slovenia PHINHY-L78036 Switzerland PHINHY-L78037 Uzbekistan PHINHY-L78038 Germany PHINHY-L78039 Switzerland PHINHY-L78040 Switzerland PHINHY-L78041 Italy PHINHY-L78042 United Arab Emirates PHINHY-L78043 Switzerland PHINHY-L78044 Slovenia PHINHY-L78045 Uzbekistan PHINHY-L78046 Switzerland PHINHY-L78047 Switzerland PHINHY-L78048 Uzbekistan PHINHY-L78049 Switzerland PHINHY-L78050 Switzerland PHINHY-L78051 Slovenia PHINHY-L78052 Uzbekistan PHINHY-L78053 Switzerland PHINHY-L78054 Switzerland PHINHY-L78055 Switzerland PHINHY-L78056 Ukraine PHINHY-L78057 Ukraine PHINHY-L78058 Slovenia PHINHY-L78059 Ukraine PHINHY-L78060 Ukraine PHINHY-L78061 Switzerland PHINHY-L78062 Ukraine PHINHY-L78063 Slovenia PHINHY-L78064 Uzbekistan PHINHY-L78065 Switzerland PHINHY-L78066 Slovenia PHINHY-L78067 Japan PHINHY-L78068 Slovenia PHINHY-L78069 Uzbekistan PHINHY-L78070 Switzerland PHINHY-L78071 Uzbekistan PHINHY-L78072 Japan PHINHY-L78073 Uzbekistan PHINHY-L78074 Japan PHINHY-L78075 Switzerland PHINHY-L78076 Switzerland PHINHY-L78077 Egypt PHINHY-L78078 Germany PHINHY-L78079 Uzbekistan PHINHY-L78080 Switzerland PHINHY-L78081 Switzerland PHINHY-L78082 Germany PHINHY-L78083 Italy PHINHY-L78084 Switzerland PHINHY-L78085 Czech Republic PHINHY-L78086 Belgium PHINHY-L78087 Slovenia PHINHY-L78088 Colombia PHINHY-L78089 Switzerland PHINHY-L78090 Turkey PHINHY-L78091 Japan PHINHY-L78092 France PHINHY-L78093 Japan PHINHY-L78094 Slovenia PHINHY-L78095 Spain PHINHY-L78096 Japan PHINHY-L78097 Switzerland PHINHY-L78098 Switzerland - AnonymousNot applicable
Hi, AbhishekAejae
Thanks for rajendraongole1 reply. You can try the following measure to achieve your need.Counts = VAR __countsCountry = CALCULATE ( COUNT ( 'Table'[Country] ), ALLEXCEPT ( 'Table', 'Table'[Country] ) ) RETURN __countsCountry Flag = IF ( [Counts] > 3, 1 ) Rank = VAR __rank = RANKX ( FILTER ( ALLSELECTED ( 'Table' ), [Flag] = 1 ), [Counts],, ASC, DENSE ) RETURN __rank
Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum