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

Announcements
FLASH SALE: Save $500! Use code FLASH2026 at checkout until Feb 14th at 11:59PM ET. Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Change in Month data

I have the following formula that is not working.  I am looking in the +/- change Month over Month.  I am only getting the same value as the current month with the below formula.

=Num(Count(Distinct{<[Monthly Issue Severity]={High},[Monthly Load Date] = {'$(=Max([Monthly Load Date]))'}>} [Monthly Issue ID])-Count(Distinct{<[Monthly Issue Severity]={High},[Monthly Load Date] = {'$(=Max([Monthly Load Date]) - 1)'}>} [Monthly Issue ID]),'0') 

Any assistance would be appreciated!

19 Replies
Not applicable
Author

Aiolos, the Load Date is the same field, there are dates that have been imported, and have been set to maintain date status in the load statement.

Load Statement:

Date([Monthly Load Date],'M/D/YYYY') as [Monthly Load Date]

I did try what you mentioned above and there was no change in the +/- calculation, I am still getting the same result as the Monthly Load date calculation. 

vishsaggi
Champion III
Champion III

Yes, but your excel sheet has not got any dates between 1/1/2017 and 12/1/2016. So i am not sure if this is what you are looking for. Attached is the sample i worked on, if not send me new updated sheet with some dates between those dates.

stabben23
Partner - Master
Partner - Master

Hi Silvia,

this [Monthly Load Date] = {'$(=Max([Monthly Load Date])) will gives you 2017-01-01 if you have correct dateformat.

This [Monthly Load Date] = {'$(=Max([Monthly Load Date]) - 1)'}>} will NOT gives you 2016-12-01 as you expect.

It could gives you a numeric value as Aiolos says, it could gives you 2017-01-00

Put both Expressions in a straigt tablechart without any label, hover over label in chart and see what you get.

stabben23
Partner - Master
Partner - Master

Try this Expression after the '-' in your expression

Count(Distinct{<[Monthly Issue Severity]={'High'},[Monthly Load Date] = {"$(=max(addmonths([Monthly Load Date],-1))) "}>} [Monthly Issue ID]),

vishsaggi
Champion III
Champion III

Sorry misunderstood i believe, you were looking for Month on Month right so You want to see the 1/1/2017 counts and your date-1 is like 1 month behind so it will be 12/1/2016. Just follow what Staffan mentioned to use Addmonths and try?

vishsaggi
Champion III
Champion III

Adding to what Staffan mentioned use below to get the difference. I used this when loading data from excel in the load statement

LOAD Date(Num([Monthly Load Date]), 'MM/DD/YYYY') AS [Monthly Load Date], col2, co3

FROM yourexcelsource;

You H column will be

=count({1}Distinct{<[Monthly Issue Severity] ={'High'},

                     [Monthly Load Date] = {"$(= Max([Monthly Load Date]) )"}>} [Monthly Issue ID])

Your PreviousMonth will be

= Count({1}Distinct{<[Monthly Issue Severity]={'High'},

                      [Monthly Load Date] = {"$(= Max(Date(AddMonths([Monthly Load Date], -1), 'MM/DD/YYYY')) )"}>} [Monthly Issue ID])

Your difference will be +/- MOM

=  Num(Count(Distinct{<[Monthly Issue Severity]={'High'},

                      [Monthly Load Date] = {"$(=Max([Monthly Load Date]))" }>} [Monthly Issue ID])

    -

      Count(Distinct{<[Monthly Issue Severity]={'High'},

                      [Monthly Load Date] = {"$(= Max(Date(AddMonths([Monthly Load Date], -1), 'MM/DD/YYYY')) )"}>}        [Monthly Issue ID]), '0')

Not applicable
Author

I still get the same result, using your formula Staffan.

I should be getting a change of -1.  The Monthly Load Date is a date for 12/1 and 1/1, I ensured it in my Load Statement, I am not sure why my formula is not working as it should, by giving me the answer of -1

Not applicable
Author

For some reason the formula is not calculating the data for 12/1, I used your advice Staffan and for the period of 12/1, I am getting 0 for Total Monthly Issue ID, when I should get 125

vishsaggi
Champion III
Champion III

Did you try my expressions ? It is giving me -1 ?

Attached.

Not applicable
Author

You are a life saver!!  Thank you so much!