# Sublist Count

**URL:** <https://forum.dynamobim.com/t/sublist-count/18199>\
**Category:** Uncategorized\
**Created:** [January 16, 2018, 9:20pm UTC](https://forum.dynamobim.com/t/sublist-count/18199 "2018-01-16T21:20:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![moeng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/moeng/32/39685_2.png) [@moeng](https://forum.dynamobim.com/u/moeng)\
**Post date:** [January 16, 2018, 9:20pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/1 "2018-01-16T21:20:24Z")

</div>

I have a list with sublist and need to count the sublists that are the same.

Cant figure it out?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/6/8697f89df8e0f2cb0db7f840bd3233395c44a8ff.png)

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [January 16, 2018, 9:23pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/2 "2018-01-16T21:23:23Z")

</div>

Use the List.Count node and change the Levels. Here is information on Lists @ Levels [http://dynamobim.org/introducing-listlevel-working-with-lists-made-easier/](http://dynamobim.org/introducing-listlevel-working-with-lists-made-easier/)

---

<div class="post-metadata">

**Author:** ![moeng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/moeng/32/39685_2.png) [@moeng](https://forum.dynamobim.com/u/moeng)\
**Post date:** [January 16, 2018, 9:27pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/3 "2018-01-16T21:27:08Z")

</div>

Maybe I explained it wrong.  
List 1 and 2 has the same value in index 0 to 3 so instead I need 1 list with those indexes.

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [January 16, 2018, 9:34pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/4 "2018-01-16T21:34:33Z")

</div>

If I am understanding correctly, you want to get rid of duplicate sublists? List.UniqueItems will give you a list of only the unique sublists in your list. 🙂

---

<div class="post-metadata">

**Author:** ![moeng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/moeng/32/39685_2.png) [@moeng](https://forum.dynamobim.com/u/moeng)\
**Post date:** [January 16, 2018, 9:41pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/5 "2018-01-16T21:41:00Z")

</div>

Thank you. That was easy

---

<div class="post-metadata">

**Author:** ![moeng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/moeng/32/39685_2.png) [@moeng](https://forum.dynamobim.com/u/moeng)\
**Post date:** [January 16, 2018, 9:53pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/6 "2018-01-16T21:53:09Z")

</div>

One more question.  
How can I count the number of all list that I just combined into unique lists?

Not sure I explained this correct. Does it make sense?

What i want is to count how many of each unique item there is?

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [January 16, 2018, 10:08pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/7 "2018-01-16T22:08:55Z")

</div>

Do you mean to count how many sublists there were for each unique sublist?

---

<div class="post-metadata">

**Author:** ![moeng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/moeng/32/39685_2.png) [@moeng](https://forum.dynamobim.com/u/moeng)\
**Post date:** [January 16, 2018, 10:09pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/8 "2018-01-16T22:09:44Z")

</div>

Exactly!

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [January 16, 2018, 10:11pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/9 "2018-01-16T22:11:26Z")

</div>

Hmm well my first thought is to use List.GroupByKey, and since lists as keys are not supported, to use a String.Join to get the keys from the sublists. There might be a better method but off the top of my head this does the trick:

 ![group by key with lists](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/0/e083a202e4cbd272650b35034f49db75284b5626.png)

---

<div class="post-metadata">

**Author:** ![moeng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/moeng/32/39685_2.png) [@moeng](https://forum.dynamobim.com/u/moeng)\
**Post date:** [January 16, 2018, 10:12pm UTC](https://forum.dynamobim.com/t/sublist-count/18199/10 "2018-01-16T22:12:24Z")

</div>

Thank you. I will try that.
