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

Grouping data in straight table

Hi All,

I have a dynamic straight table with few dimensions and measures.

In my data schema, I have a field called "News" which have few values, like: "Sports", "Economics", etc.

I'd like to add an expression field to my straight table, which will show for each value in "News", how many records exists for this value.

For example, If I filter my data for October 2015, I'll see: "Sports (30 records), Economics (50 records)" with regard to this dimension and other dimensions selected in this table.

I tried to use aggr() function in my straight table, but it doesn't work since I don't know in advance which dimensions will be selected in the straight table (Users can add / remove dimensions)

Thanks.

1 Solution

Accepted Solutions
rubenmarin

Hi, you'll need some dynamic aggr(), check attachment to see a possible solution.

View solution in original post

9 Replies
pamaxeed
Partner - Creator III
Partner - Creator III

Hi,

can you provide a sample app, so that it is simpler for us to understand?

Thanks,

Patric

tresesco
MVP
MVP

Resolution would actually depend on how you are defining (expression) dimension to make it dynamic. Try to share your sample qvw.

rubenmarin

Hi Yehuda, If the user selects the dimensions from a field you can try this:

Concat(Aggr(News & '(' & Count(News) & 'records)', $(=GetFieldSelections(DimensionSelectorFieldName)), News), ',')

Not tested.

petter
Partner - Champion III
Partner - Champion III

I think this should work for you:

Count( DISTINCT TOTAL <News> RecordID )

Not applicable
Author

Hi,

An example is attached. The text box is the desired field (result) I want in my table.

Please take into account that there might be more dimensions which can be in the main table and the straight table (not only Date_Id & Month_Id).

Thanks

rubenmarin

Hi, you'll need some dynamic aggr(), check attachment to see a possible solution.

petter
Partner - Champion III
Partner - Champion III

You have to adjust the fields mentioned after total within the <> according to the dimensions you include in your chart. So giving a fixed expression for you when you say that "there might be more dimensions" makes it impossible.

Aggr() will maybe not be necssary - and should be avoided if you can- unless you want to aggregate on more dimensions than the ones that are used in your chart. TOTAL is the most efficient solution but is relies on you being able to include only the dimensions from the chart that will give you the right level of total.

tresesco
MVP
MVP

May be simply like:

Dim: News

Exp: Count(News)

Not applicable
Author

This is what I was looking for.

Thanks a lot!