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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Mukesh_10
Contributor
Contributor

Field values for the previous month patient cost and previous month count

Hi ,

1) Can you please explain about those values which are showing up in the previous month sales and previous month count field without doing any selection.

As far my understanding when we don't make any selection for the year it takes the max year and provide the values of the previous year. But I didn't understand about the values present in other fields. How and why those fields are generating those values without making any selection.

I also see the previous month number is higher than previous year.

Mukesh_10_0-1640256269159.png

 

Can any one explain what actually happening and what are those values.

These are my set expressions

for Previous month


Sum
(
{$
< Date={">= AddMonths(MonthStart(Max(Date)),-1)<MonthStart(Max(Date))"}>

}
Cost
)

 

<iframe src="http://localhost:4848/single/?appid=C%3A%5CUsers%5CA%5CDocuments%5CQlik%5CSense%5CApps%5CPatient%20C..." style="border:none;width:100%;height:100%;"></iframe>

Thanks

1 Solution

Accepted Solutions
rubenmarin1

Hi, as said before you need to use the Date field name, I see two fields in you app that can be a date: DateKey and DayDate.

Also if you want to select a month or select january and show the value of december of last year... or anything that you want data that changes your selcted values, you also need to exclude this fields from selections, so at the end you can use an expression like:

Sum
(
{$
< DayDate={">=$(=Date(AddMonths(MonthStart(Max(DayDate)),-1)))<$(=Date(MonthStart(Max(DayDate))))"},YearMonth,YearNum>
}
Cost
)

If you don't add YEarMonth to ignore field selctions it will apply this selctions and the filter for dates, so if you select aug-2019 it will try show values with dates for july-2019 and with month aug-2019, and there will be no data that accomplish both.

 

View solution in original post

6 Replies
rubenmarin1

Hi, try with:

Sum
(
{$
< Date={">=$(=Date(AddMonths(MonthStart(Max(Date)),-1)))<$(=Date(MonthStart(Max(Date))))"}>
}
Cost
)

Mukesh_10
Contributor
Contributor
Author

Thanks for the reply.

But Its still showing the current month cost(i.e. selected Month) . I don't understand whats going wrong.

Just attaching the screenshots please look at them and reply.

 

In the Script editor page after writing expression it should show the values it going to be displayed but in this case nothing is displayed.

 

ThanksYou can also see in the bottom left in box . its nothing populated for the  expression we written.You can also see in the bottom left in box . its nothing populated for the expression we written.Screenshot (30).png

Mukesh_10
Contributor
Contributor
Author

Thanks for the reply.

But Its still showing the current month cost(i.e. selected Month) . I don't understand whats going wrong.

Just attaching the screenshots please look at them and reply.

 

In the Script editor page after writing expression it should show the values it going to be displayed but in this case nothing is displayed.

 

Thanks

Mukesh_10_0-1640426965917.png

 

You can also see in the bottom left in box . its nothing populated for the expression we written.

Mukesh_10_1-1640426965881.png

 

 
 
rubenmarin1

Hi, 'Date' is in blue, if there was a field called 'Date' it should be shown as orange (like 'Cost'), so you need to create the Date field or use the field name for dates.

Sum
(
{$
< DateFieldName={">=$(=Date(AddMonths(MonthStart(Max(DateFieldName)),-1)))<$(=Date(MonthStart(Max(DateFieldName))))"}>
}
Cost
)

Mukesh_10
Contributor
Contributor
Author

Hi Sir,

I attached the link for my app. I need a set expression for previous year cost or previous year count.

If possible can you also explain how the expression works please.

 

Thanks

rubenmarin1

Hi, as said before you need to use the Date field name, I see two fields in you app that can be a date: DateKey and DayDate.

Also if you want to select a month or select january and show the value of december of last year... or anything that you want data that changes your selcted values, you also need to exclude this fields from selections, so at the end you can use an expression like:

Sum
(
{$
< DayDate={">=$(=Date(AddMonths(MonthStart(Max(DayDate)),-1)))<$(=Date(MonthStart(Max(DayDate))))"},YearMonth,YearNum>
}
Cost
)

If you don't add YEarMonth to ignore field selctions it will apply this selctions and the filter for dates, so if you select aug-2019 it will try show values with dates for july-2019 and with month aug-2019, and there will be no data that accomplish both.