Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

hammermill21
Contributor II

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

Re: Comparing Month Differences

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))

)

7 Replies
sasiparupudi1
Honored Contributor III

Re: Comparing Month Differences

pl post a sample

Re: Comparing Month Differences

But I thought it did work yesterday?

hammermill21
Contributor II

Re: Comparing Month Differences

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.

Re: Comparing Month Differences

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
Contributor II

Re: Comparing Month Differences

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?

Re: Comparing Month Differences

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
Contributor II

Re: Comparing Month Differences

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!

Community Browser