Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hammermill21
Creator III
Creator III

Comparing Month Differences

Hello,

I have data on various months and I need to be able to select two different months and get the percentage difference between the two. So for February, I have 43% and for March I have 50% so I need to see that the difference is 15.05% but I"m not sure how to do that. Currently to calculate the percentage per month I use:

Count({<[UMHC SYSTEM]={"100%"},[EC-LS-EM]={'EC'}>}[UMHC SYSTEM])/Count({<[EC-LS-EM]= {'EC'}>}[UMHC SYSTEM])

I tried adding Min  & MaxString but that's not working.

Thank you!

1 Solution

Accepted Solutions
sunny_talwar

Try this

(

Count({<[UMHC SYSTEM]={'<.81'},[EC-LS-EM]= {'EC'}, Month = {"$(=MaxString(Month))"}>} [UMHC SYSTEM])/16

)

/

(

Count({<[EC-LS-EM]= {'EC'}>} EP#) / (16 * count({<Date={'<=$(=today())'}>}distinct Month))

)

View solution in original post

7 Replies
sasiparupudi1
Master III
Master III

pl post a sample

sunny_talwar

But I thought it did work yesterday?

hammermill21
Creator III
Creator III
Author

Hey Sunny, it is working for the KPI, but I'm trying to use another way also. They like to view the information in many different ways. So I'm trying to:

Count The number of standards within the max month (which you showed me yesterday):

Count({<[UMHC SYSTEM]={'<.81'},[EC-LS-EM]= {'EC'}, Month = {"$(=MaxString(Month))"}>} [UMHC SYSTEM])

Then divide that by the count of standards all together:

Count({<[EC-LS-EM]= {'EC'}>} EP#) / (16 * count({<Date={'<=$(=today())'}>}distinct Month))

So what I need to do it put them together so I can show the difference.

sunny_talwar

Then divide that by the count of standards all together.

Assume I don't know what this means, can you expand on this a little to help you better?

hammermill21
Creator III
Creator III
Author

Hey Sunny,

So when I do that and divide by all the standards I get the wrong total.

Count The number of standards within the max month (which you showed me yesterday):

Count({<[UMHC SYSTEM]={'<.81'},[EC-LS-EM]= {'EC'}, Month = {"$(=MaxString(Month))"}>} [UMHC SYSTEM])/16

This equals 87

Then divide that by the count of standards all together:

Count({<[EC-LS-EM]= {'EC'}>} EP#) / (16 * count({<Date={'<=$(=today())'}>}distinct Month))

This equals 188

So then 87/188 is 46% which is the right amount, but when I put the expression altogether and divide it by the count of all standards I get 3%. So I think I am putting it together incorrectly.

Does that make more sense?

sunny_talwar

Try this

(

Count({<[UMHC SYSTEM]={'<.81'},[EC-LS-EM]= {'EC'}, Month = {"$(=MaxString(Month))"}>} [UMHC SYSTEM])/16

)

/

(

Count({<[EC-LS-EM]= {'EC'}>} EP#) / (16 * count({<Date={'<=$(=today())'}>}distinct Month))

)

hammermill21
Creator III
Creator III
Author

That's what I was missing, the ( ) to break it up.

Thanks Sunny, now I should be able to continue building.

Have a wonderful day!