---
title: "Document Stats Report Macro"
canonical: "https://support.appfire.com/space/CDML/649889641/Document%20Stats%20Report%20Macro"
format: markdown
---
> Macro (aura-html)


## Overview


> Macro (excerpt)
> 
> The **Document Stats Report** macro displays a count of the content currently in each workflow state.
> 
> ![image](media://e8a75478-3fc0-44a7-bb0a-e2e830e4eb25)
> 
> By default, the workflow information in the report columns includes all the workflow states in the current space (except for the space homepage).
> 
> One or more filters can be added to the [document-stats-report macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649793642), for example, filter the display to specific states or states in one or more workflows.
> 
> Once added to a page, the report macro dynamically updates the count for each state.
> 
> ## Permissions
> 
> Anyone can see this report.
> 
> [View-only users](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650217543) only see results for content that has reached a Published (** **`final=true`** **) state, even if there are subsequent draft state edits to that page or blog post.
> 
> Pages and blog posts that have not yet been published or have an applied workflow that does not define a published state are not shown.
> 
> Administrators can make all results available to everyone by changing the ** **[Workflow Activity and Drafts Visibility](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649956239)** **settings globally for the instance or in each space.
> 
> ## Adding the report
> 
> To add the report to a page choose the **Document Stats Report** macro.
> 
> In the draft page editor, either
> 
> - open the macro editor
>   - choose the Confluence header option** **> Macro (inline-media-image)
> 
> ** → Other Macros → Reporting → Document Stats Report**
>   - choose** Insert**
> - type **{document stats ...**  on the page and select** Document Stats Report**
> 
> ![cdmdc_documentstatsreport_openmacrobrowser.png](media://2d68530b-975e-4bfa-81a4-1abf559bf172)
> 
> Configure the macro settings:
> 
> - choose**  Edit **the report macro
> 
> ![cdmc_documetstatsreport_editmacrooption.png](media://b0fb3cc1-0fcd-4305-a7f0-b7a2b95049a9)
> 
> In the macro editor
> 
> - choose report filters and display column settings
>   - scroll down the macro editor to add or edit report additional filter options
> 
> > ℹ️ By default, the report displays a count for all workflow states including those where no content is currently in the state (count is zero).
> 
> - choose **Save** to update the macro on the draft page
> - choose **Update** to add the report to the published page
> 
> 
> Here's how the report looks on your page.
> 
> ![image](media://ecdafdc8-b083-414e-ba5d-73066f2fad3f)
> 
> ## Customizing the report
> 
> Edit the **Document Stats report** macro to customize the report by
> 
> You can choose to filter the state count for the content by
> 
> - label(s)
> - parent
> - space(s) using the spacekey
> 
> If multiple labels are added the report displays the state information for content with each label.
> 
> > ✅ To display information for content that must have all the specified labels, add the **&** (and ampersand) operator in front of the first label in the list
> 
> The macro can also be customized for
> 
> - one or more states
> - one or workflows
> 
> ### Filter the report
> 
> In the macro editor select options to filter the report. Options include filter by state, space key, label, parent page, and workflow (see table below).
> 
> For example, add a filter on the **State(s) **filter using **Published**
> 
> The filtered report displays only the content with the named state, **Published**.
> 
> ![image](media://73bfe652-099c-473c-afe0-b2cdbbd9806d)
> 
> > ℹ️ If a workflow has been removed from a page in the scope of the report macro, but the document activity has been retained, the report shows the last state information for the content.
> 
> ## Report filters
> 
> The filters are listed alphabetically in the macro editor.
> 
> | Setting | Default | Notes | Version |
> | --- | --- | --- | --- |
> | **Label** | none | Should the report be filtered by content label(s)?<br>- leave empty to include all content
> - list one label name to filter to a specific label
> - list multiple label names, separated by commas, to filter to content with any of those labels<br>If using a list of labels, you can prefix the list with  ** **`&`(ampersand) to require that the content has all the labels. O*therwise, it will report pages containing any of the listed labels.* |  |
> | **Parent page** | blank (*current space home page*) | The report is limited to child pages only of the space home page or specified page.<br>- leave empty to include all content in the space (does not include the home page as this is the default parent)
> - use **@self** to  report on the child pages of the current page
> - specify a page title to include only its child pages<br>> 📝 If specifying a parent page, you cannot list multiple space keys. The report defaults to the child pages of the added parent page. |  |
> | **Ancestor page** | blank | The report is limited to the descendants of the specified page.<br>- use **@self** to report on the descendant pages of the current page
> - specify a page title to include only its descendant pages<br>> 📝 If specifying an ancestor page, you cannot list multiple space keys. The report defaults to the descendant pages of the added page. | v7.7.0+ |
> | **In space** | blank (*current space*) | The comma-separated list of space keys to filter.<br>If multiple spaces are specified, the table counts all content states. |  |
> | **States(s)** | blank (*all states*) | A comma-separated list of states to be displayed in the report. The report displays the count for all the content in each state in the scope of the macro editor settings.<br>- leave empty to include all content in all states
> - limit report by listing one or more state names in a comma-separated list
> - states displayed in the report are listed in the order added to the macro (only from [v6.16.4+](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649529359))<br>The report includes the state count for content where the workflow has been removed, but the workflow history has been retained |  |
> | **Workflow(s)** | blank (*all workflow states*) | A comma-separated list of workflows to be displayed.<br>- leave empty to include all content in all states in all workflows
> - limit the report by listing one or more workflow titles in a comma-separated list<br>> 📝 If left empty, the report displays all a report for states in both space and page workflows in the report’s scope. However, you can only specify space workflow names. There is no option to use a page workflow name.<br>If left empty, then the report includes the state count for content where the workflow has been removed but the workflow document activity has been retained |  |
> 
> ## Reporting columns
> 
> The report column order is defined by the entry of the state name column in the macro editor.
> 
> The **document-stats-report macro** can be added to the Confluence chart macro to display the report information.
> 
> ![cdmc_chartmacro_with_documentstatsreportmacro_draftpage.png](media://52bcffdf-48c4-4089-8846-dc3eaae8c379)
> 
> The [Confluence Chart macro](https://confluence.atlassian.com/doc/chart-macro-163415075.html) display is based on the [document-stats-report](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649793642) macro filters
> 
> ![image](media://c944aac7-2877-40cd-883c-e278f628f471)
> 
> > ℹ️ The **Chart **macro assumes the first column, **0**, is a series name, but the **Document Stats Report **macro uses it for the first state.
> > ℹ️ 
> > ℹ️ To ensure that the information for the first state from the **Document Stats Report macro** is displayed in the chart
> > ℹ️ 
> > ℹ️ - in the [Chart macro](https://confluence.atlassian.com/doc/chart-macro-163415075.html) **Columns** setting add the number **0 **(zero)
> > ℹ️ 
> > ℹ️ Next
> > ℹ️ 
> > ℹ️ - enter a comma-separated list of the states you want to display (the Document Stats Report column headings)
> > ℹ️ 
> > ℹ️ For example, to display the following four workflow states **Editing**, **Approved**, **Published,** **In Progress**, in the macro editor for the [Confluence Chart macro](https://confluence.atlassian.com/doc/chart-macro-163415075.html) add the following to the **Columns** dialog box
> > ℹ️ 
> > ℹ️ - "0, Editing, Approved, Published,  In Progress"
> > ℹ️ 
> > ℹ️ This displays a total of 4 columns or 4 pie segments.
> 
> ## Why are old states shown?
> 
> If the table shows states from old Comala workflows that are no longer used, [purging the space trash](https://confluence.atlassian.com/doc/delete-or-restore-a-page-139429.html#DeleteorRestoreaPage-purgeEmptythetrashorpermanentlydeleteapage) should solve the problem (as any deleted pages in the space trash retain their workflow information).
> 
> 
> 
> ## Related pages
> 
> **[Report macros](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649856031)**
> 
> > Macro (contentbylabel)