Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

An issue has been identified on Qlik Cloud hub, please visit our Status Update Page for details: GET THE LATEST
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

Subtracting one set from another


Sorry, this seems simple but cant wrap my head around it.

I have a dimension 'SubType'

Within this dimension, I have a number of items measuring electricity for example [Electricty], [Renewable], [RECs]

I'm trying to create a Piechart that shows the portion of Renewable to Electricity.  For this, i need to subtract the [RECs] from the [Electricity]


This attempt of course shows me the proportions of all the data.  

>} TotalUsage)


Do i need to do this before i aggregate it in the set expression? A custom Field perhaps?


any advice most welcome

5 Replies

Are you saying that you are looking to sum(TotalUsage) where SubType is not RECs? May be this

Sum({$<InvoiceSubTypeName -= {'RECs'}, PeriodFinancialYear = {'$(vReportingFiscalYear)'}>} TotalUsage)
Contributor II
Contributor II

You are right in that I do not want to see the [RECs] in the piechart and understand -= will exclude them from the visualisation.

I want to subtract [RECs] from [Electricity] and have the Piechart show the results.





This is what I don't understand.... what does subtracting RECs from Electricity even mean? These are some values in a single row? are they within multiple rows? May be you want this?

Sum({$<InvoiceSubTypeName = {'Electricity'}, PeriodFinancialYear = {'$(vReportingFiscalYear)'}>} TotalUsage)
Sum({$<InvoiceSubTypeName = {'RECs'}, PeriodFinancialYear = {'$(vReportingFiscalYear)'}>} TotalUsage)

But again, I am not sure what you really mean when you say 'subtracting RECs from Electricity' and may be you won't get what you want using the above expression


Contributor II
Contributor II

Hi thanks for bearing with me,



Consider the above values 

I'd need to subtract [RECS] from [Electricity] and then build a Piechart that will show Electricity= 300 and Renewable =100



May be this


  Sum({$<PeriodFinancialYear = {'$(vReportingFiscalYear)'}>} TotalUsage),

  If(InvoiceSubTypeName <> 'Renewable', Sum(TOTAL {$<InvoiceSubTypeName = {'RECs'}, PeriodFinancialYear = {'$(vReportingFiscalYear)'}>} TotalUsage))