Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
stefano_bianche
Contributor II
Contributor II

Count result If

Hello to all,

I need information, I'm making comparisons between data and I'm using the following formula:

If ((sum (Revenue) -sum (AH_TotaleFattura)> 0.01) or (sum (Revenue) -sum (AH_TotaleFattura) <- 0.01), 'Total Different', 'Total Equivalent'

The formula for it works and up to here everything ok.

The only thing I wanted to know is whether there is a possibility (perhaps via in a KPI) to show how many totals are 'different' and how many are 'equal'? I would be very comfortable and functional.

Thank you

2 Replies
lfetensini
Partner - Creator II
Partner - Creator II

If you have the opportunity, it might be interesting to create this formula in the script editor. So with a column of this data (like dimension in your QVD) you can simply capture them with the count command.


Script editor:

If ((sum (Revenue) -sum (AH_TotaleFattura)> 0.01) or (sum (Revenue) -sum (AH_TotaleFattura) <- 0.01), 'Total Different', 'Total Equivalent' ) as [My Formula]


Chart:

Dimension: [My Formula]

Expression: count([My Formula])


KPI:

Dimension: [My Formula]

Expression: count({<[My Formula]={'Total Equivalent'}>} [My Formula])

Support your colleagues. Remember to "like" the answers that are helpful to you and flag as "solved" the one that helped you solve. Cheers.
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

To calculate "how many", you'll need to define what dimension represents "many" and use that in an aggr. For example, to count how many are "different" (ie the expression is true) by Product.

Aggr(-sum(

(sum (Revenue) -sum (AH_TotaleFattura)> 0.01) or (sum (Revenue) -sum (AH_TotaleFattura) <- 0.01)

)

,Product)


-Rob

http://masterssummit.com

http://qlikviewcookbook.com