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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Set Analysis little issue

Hi Guys,

I am trying to use the following formula within a bar chart to get an average

=Sum({1<[Type]={'A'}>}[Amount])/Sum({1}B)

The Dimension is C.

I need to get a straight line of average across the bar chart. Not sure what I am doing wrong here.. I've done this hundred times before with no issue.

The formula above returns a zigzag line that moves with the bars..

Let me know your thoughts and thanks in advance.

Best,

Alec

24 Replies
MK_QSL
MVP
MVP

Dimension = C

=Sum({1<[Type]={'A'}>}[Amount])/Sum({1}B)


Let me clarify...

B = amount

Amount = Amount (Is B and Amount is different?, sorry for my stupid question, my intention is to help you..)

C = State

Type = any Type (i.e. Dimension)

If you give us three four lines data for above dimensions and your end results, would better ...!


Brice-SACCUCCI
Employee
Employee

What about

=Sum({<[Type]={'A'}>}[Amount])/ Sum ({1}B)

?

alec1982
Specialist II
Specialist II
Author

Sure, thank you for your help

C          Type     Amount     Count

GA        A         200          25          

GA        B         250          25

CL         A        150          20

NC         B        350          35

NY         B        175          45

=Sum({1<[Type]={'B'}>}[Amount])/Sum({1}Count)

alec1982
Specialist II
Specialist II
Author

this returns different value for each bar

MK_QSL
MVP
MVP

I am confused now.

You said B is an amount and here B is a Type..!!

MK_QSL
MVP
MVP

Try This...

=SUM({1<Type = {'A'}>}Amount)/COUNT({1}Count)

alec1982
Specialist II
Specialist II
Author

Sorry, I changed the structure and added the formula below it o it will be clear.

MK_QSL
MVP
MVP

Is my above answer working?

if not, let me know your logic of average. I will come back to you on this.

alec1982
Specialist II
Specialist II
Author

This logic doesn't work. it gives a zigzag line which means a different value for each bar of the dimension.

MK_QSL
MVP
MVP

Create a variable

VAR  =SUM({1<Type = {'A'}>}Amount)/COUNT({1}Count)

= should be there in variable definition

Now Chart expression should be

$(var)