Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
swiftfahad
Contributor III
Contributor III

Creating Pie chart on expression value

Hi All,

I am using a table like this

VoucherIDVhrDateCustomerPaidAmtType
v-12301-01-2018abc5000Paid
V-65515-02-2018xyz4687Paid
V-69809-03-2018eee0unpaid

Expression for PaidAmt is

=sum(receive_amt)

issue is the type column is also an expression field i.e =if(sum(receive_amt) = 0,'Unpaid','Paid');

now I want to show above table in pie chart to show the count of customer who paid/unpaid, something as in attached file

2 Replies
uacg0009
Partner - Specialist
Partner - Specialist

Hi muhammad,

I think you can use column "Type" as dimension and use Count(distinct VoucherID) as expression.

Then you can make it.

Thanks.

Aiolos

petter
Partner - Champion III
Partner - Champion III

Qlik will not accept having an expression like this that is a so-called nested aggregation:

    Count( Sum(PaidAmt)=0 )

but you are allowed to nest aggregations if the inner aggregation has a TOTAL quaifier:

    Count( Sum(TOTAL PaidAmt)=0 )

However you need Aggr() to create the two dimension values in a calcuated dimension:

Create the bar chart and press the "calculated dimension" on the Dimension tab to create the unpaid/paid values:

    =Aggr( If(Sum(PaidAmt)=0,'unpaid','paid') , Customer )


    if the paid status should be calculated not just per Customer but per VoucherID, VhrDate and Customer then:

    =Aggr( If(Sum(PaidAmt)=0,'unpaid','paid') , VoucherID, VhrDate, Customer )

Then add the expression

  =Count(Sum(TOTAL PaidAmt) = 0)