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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
hammermill21
Creator III
Creator III

Division calculation in Qlik Sense

Hello

I have a table that shows the amount of inspections done per room and I need to calculate the percentage done based on it if passed or not.

So for the "Dated"  inspections there was 3 in total and only 2 passed, so it's 2/3 = 67% which I wrote out the expression like this:

Count({<Dated={'Yes'}>}Dated)/Count([Unit])

*Count the total Dated inspections that = yes and / it by the count of units

I'm getting 100% but I know it should be 67%. Any ideas?

Thanks!!

10 Replies
sunny_talwar

Do you have Dated as a dimension?? May be this in that case

Count(Dated)/Count(TOTAL <FirstDimensionHere> [Unit])

devarasu07
Master II
Master II

Hi,

Try like below,

Count({<Dated={'Yes'}>}Dated)/Count(Total [Unit])

hammermill21
Creator III
Creator III
Author

I tried this one also, still getting 100%

sunny_talwar

Is Dated your dimension where you are trying to calculate this?

hammermill21
Creator III
Creator III
Author

I was just trying your suggestion, yes  Dated is a dimension. Does that make a difference?

Thank you as always for your help!

sunny_talwar

Try this in that case

Count(Dated)/Count(TOTAL <FirstDimensionHere> [Unit])

or

Count(TOTAL {<Dated={'Yes'}>}Dated)/Count([Unit])

Replace FirstDimensionHere with whatever other dimension you have in your chart

devarasu07
Master II
Master II

Hi,


Can you share your app with mock data. Thanks

sunny_talwar

Assuming you have 2 dimensions (Dim1, Dated), you can try this

Count(Dated)/Count(TOTAL <Dim1> [Unit])

Assuming you have 3 dimension(Dim1, Dim2, Dates), you can try this

Count(Dated)/Count(TOTAL <Dim1, Dim2> [Unit])

devarasu07
Master II
Master II

Hi,300.png

Sample posted,

Sales/ total sales:

sum(Sales)/sum(TOtal Sales)

Sales/ Group by Country Sales Total:

sum({<write u r sets here>}Sales)/sum(TOtal <Country>Sales)