Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count(TOTAL <[Master Dimension]> Product)

If possible can someone point me at documentation explaining why this works even though there is an error in the expression editor?

Given that I have a master dimension as "Master Dimension"

The measure for my chart is:

Count(Product)/Count(TOTAL <[Master Dimension]> Product)

I get this error

Bad field name: [Master Dimension]

But the the chart still renders and saves normally.

My chart has two dimensions the first is "Master Dimension" and the second is "Product". For a Customer each Product should have it's own bar in the chart. The bar represents the percentage of time that product appears for that customer. For Astrida AA appears twice and she has 3 product rows so that's 66.7%. The graph displays as expected but I can't explain why.

I've attached a simple app. That demonstrates the issue. Here is the load script if needed.

ProductData:

LOAD * inline [

Customer|Product|UnitSales|UnitPrice

Astrida|AA|4|16

Astrida|AA|10|15

Astrida|BB|9|9

Betacab|BB|5|10

Betacab|CC|2|20

Betacab|DD||25

Canutility|AA|8|15

Canutility|CC||19

] (delimiter is '|');

Labels (1)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

TL;DR Use the load script to Change the name of the field.

Ah, figured it out. We use the master dimension so that we could have clean names for displayed above the selected filters and the use of LTrim was part of that. When the master dimensions was just the field it would not use the label but when the dimension was a formula it used the label.

Now in the load script we can load the field as "Master Dimension" and it will have a nice label when when to filter the selection.

View solution in original post

4 Replies
sunny_talwar

Syntax editor doesn't always understand all the syntax... but the fact that it works is something I would have not expected. It am not sure if this will even work if Master Dimension was an if statement instead of just =LTrim(Customer)

Anonymous
Not applicable
Author

I'm hesitant to use this in a production app. I'm wondering if you see a better way to achieve the same result?

sunny_talwar

May be this

Count(Product)/Count(TOTAL <Customer> Product)

or this

Count(Product)/Aggr(NODISTINCT Count(Product), Customer)

Anonymous
Not applicable
Author

TL;DR Use the load script to Change the name of the field.

Ah, figured it out. We use the master dimension so that we could have clean names for displayed above the selected filters and the use of LTrim was part of that. When the master dimensions was just the field it would not use the label but when the dimension was a formula it used the label.

Now in the load script we can load the field as "Master Dimension" and it will have a nice label when when to filter the selection.