Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting the row count of chart in text object

Hi Guys,

I would like to know if there is any function I can use to find the number of rows of a chart object. that is, when a specific selection is made, I want to get the row count of a straing table chart in a text box. I was trying out with nowofrows() function, but I was not able to get to the solution I was checking. Please give me some inputs for the same.

Thanks for all the help in advance.

Thanks and Regards

Joseph

4 Replies
Not applicable
Author

Hi Joseph,

using macro to count all the rows will work with any table but the macro must be triggered somehow (button,selection etc.) Using expression calculation in textbox also can give you the number. Can you provede a sample qvw file?

Thanks!

Stefan

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Try below macro to achive what you want.

    Sub Get_Row

    set chart = ActiveDocument.Sheets("Main").CreateStraightTable

    chart.AddDimension "Class"

    chart.AddDimension "Member"

    chart.AddExpression "only(MemberComment)"
    msgbox("number of class members = "&chart.GetNoOfRows)

    End sub

    Go to module and paste this. 

    Note: Change the dimension and expression as per your data.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
montubhardwaj
Specialist
Specialist

HI,

This is a kinda workaround if you dont want to use macro/any other code in your application. PFA.

This is just copy of actual table andhidden all all column but Total Rows.

Not applicable
Author

Number of rows in a chart could be tricky, as for the other answers.

However, if the real question is not about the number of rows, but about the count of dimension values, you're probably better set with a simple expression in the text object, something like:

=$(=Count(Distinct Dimension1 & '_' & Dimension2 & '_' & Dimension3))

I hope I can get you the idea.

Good luck!