Count items in a flat list?

CommunityMember129223
Occasional Contributor

Count items in a flat list?

Hello, 

 

I am trying to count how many items are in a list and display it in a module?

In the example below we have 3 items in the list. 

 

Does a function like this exist? 

 

 

CommunityMember129223_0-1588098473824.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
jnoone
Regular Contributor

Create a system module (with #promotion flat as a dimension) with a line item called "count" and a formula of just "1".  Create a second module which is a "totals module" (without #promotion flat as a dimension).  In the totals module create a line item called count that directly references the system module (system module.count).  It should naturally grab the top level.  

View solution in original post

6 REPLIES 6
jnoone
Regular Contributor

Create a system module (with #promotion flat as a dimension) with a line item called "count" and a formula of just "1".  Create a second module which is a "totals module" (without #promotion flat as a dimension).  In the totals module create a line item called count that directly references the system module (system module.count).  It should naturally grab the top level.  

CommunityMember129223
Occasional Contributor

Thanks! That worked. I was overthinking it. 

Javvaji45
Contributor

 if the flat list don't have top level item, how it will calculate? 

rishabh01
Frequent Contributor

hey @Javvaji45 , if you see at the screenshot there is top level item present.

Note: flat list cannot be a part of hierarchy.

Thanks.

Javvaji45
Contributor

I understood the use case , but I'm asking how we calculate with out top level item - count of list items
Javvaji45
Contributor

I got the solution for the with out top level item , we can calculate the count of items in flat list , by using the Another dimension  based on the dimension we can calculate it .