Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

sofiavaz
Contributor

Selections in bar charts

Hi all,

I'm working with two stacked bar charts: one for absolute values, other for relative values.

The dimension is weeks for both of them (field name:AllocTransfInsDateWeek) .  When working with the app, the user may want to analyse a specific week different from the current, but for these charts, the requirement is that they keep showing the whole year.

For the first one (abs values) I've used the expression bellow, and when selecting one specif week it keeps showing the whole year.

=Count({<AllocTransfMktComm*=-{"POSTPONE UNUSUED ALOCATION"}, AllocTransfOrigMillCd={'ATF'},AllocTransfTransfStat*=-{"CANCEL"},AllocTransfInsDateYear={"$(=Year(Today()))"}, AllocTransfInsDateWeek={<=$(=vCurrentInsDateWeek)"}>}AllocTransfAllocTransfId)

However, for the relative values chart, when selecting one specif week it shows only that week. The expression I'm using is this:

=count({<AllocTransfMktComm*=-{"POSTPONE UNUSUED ALOCATION"}, AllocTransfOrigMillCd={'ATF'}, AllocTransfTransfStat*=-{"CANCEL"},AllocTransfInsDateYear={"$(=Year(Today()))"}, AllocTransfInsDateWeek={"<=$(=vCurrentInsDateWeek)"}>}AllocTransfAllocTransfId) / aggr(NODISTINCT count({<AllocTransfMktComm*=-{"POSTPONE UNUSUED ALOCATION"}, AllocTransfOrigMillCd={'ATF'},AllocTransfTransfStat*=-{"CANCEL"},AllocTransfInsDateYear={"$(=Year(Today()))"}, AllocTransfInsDateWeek={"<=$(=vCurrentInsDateWeek)"}>}AllocTransfAllocTransfId),AllocTransfInsDateWeek)

I've already tried to add a set modifier = 1 but nothing happened. Do you have any idea what I might be doing wrong or how can I solve this?

thank you very much,

Sofia

1 Solution

Accepted Solutions
MVP
MVP

Re: Selections in bar charts

Try this

=Count({<AllocTransfMktComm *= -{"POSTPONE UNUSUED ALOCATION"}, AllocTransfOrigMillCd = {'ATF'}, AllocTransfTransfStat *= -{"CANCEL"}, AllocTransfInsDateYear = {"$(=Year(Today()))"}, AllocTransfInsDateWeek = {"<=$(=vCurrentInsDateWeek)"}>} AllocTransfAllocTransfId)

/

Only({<AllocTransfMktComm*=-{"POSTPONE UNUSUED ALOCATION"}, AllocTransfOrigMillCd={'ATF'}, AllocTransfTransfStat*=-{"CANCEL"},AllocTransfInsDateYear={"$(=Year(Today()))"}, AllocTransfInsDateWeek={"<=$(=vCurrentInsDateWeek)"}>} Aggr(NODISTINCT Count({<AllocTransfMktComm*=-{"POSTPONE UNUSUED ALOCATION"}, AllocTransfOrigMillCd={'ATF'}, AllocTransfTransfStat*=-{"CANCEL"},AllocTransfInsDateYear={"$(=Year(Today()))"}, AllocTransfInsDateWeek={"<=$(=vCurrentInsDateWeek)"}>}AllocTransfAllocTransfId), AllocTransfInsDateWeek))

2 Replies
MVP
MVP

Re: Selections in bar charts

Try this

=Count({<AllocTransfMktComm *= -{"POSTPONE UNUSUED ALOCATION"}, AllocTransfOrigMillCd = {'ATF'}, AllocTransfTransfStat *= -{"CANCEL"}, AllocTransfInsDateYear = {"$(=Year(Today()))"}, AllocTransfInsDateWeek = {"<=$(=vCurrentInsDateWeek)"}>} AllocTransfAllocTransfId)

/

Only({<AllocTransfMktComm*=-{"POSTPONE UNUSUED ALOCATION"}, AllocTransfOrigMillCd={'ATF'}, AllocTransfTransfStat*=-{"CANCEL"},AllocTransfInsDateYear={"$(=Year(Today()))"}, AllocTransfInsDateWeek={"<=$(=vCurrentInsDateWeek)"}>} Aggr(NODISTINCT Count({<AllocTransfMktComm*=-{"POSTPONE UNUSUED ALOCATION"}, AllocTransfOrigMillCd={'ATF'}, AllocTransfTransfStat*=-{"CANCEL"},AllocTransfInsDateYear={"$(=Year(Today()))"}, AllocTransfInsDateWeek={"<=$(=vCurrentInsDateWeek)"}>}AllocTransfAllocTransfId), AllocTransfInsDateWeek))

sofiavaz
Contributor

Re: Selections in bar charts

Thank you Sunny, it works!

Community Browser