Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
Hope you are all good.
I need your help that, i have faced one visualization issue with BAR chart object in qlik. My requirement is when user select date from [Created Date] field, then One Expression will displayed, ELSE second expression should displayed.
EX: 20JUN2029 date selected from [Created Date] field, then sales displayed from 01JAN2019 to 20JUN2019 date range as specified "WITHSELECTION" screenshot, if user doesnot select any Date by default, Current year start date to Till date SALES should displayed as specified "WITHOUTSELECTION" screenshot. for this requirement i have used [Year Month] as dimension and EXPRESSION is
If(GetSelectedCount([Created Date]) >= 1,
Count({<[Created Date] = {">=$(vSelectedDateYearStart)<=$(vSelectedPreviousDate)"}>}SALES),
Count({<[Created Date] = {">=$(vSelectedDateYearStart)<=$(vSelectedYearStart)"}>}SALES)) .
My issue is without any date selection current year start to till date BARS only should displayed, but in BAR chart displaying from data loaded dates(2018 to tilldates data) is showing in X-Axis, iam expecting only current year data.
when i apply TRUE expression(withselection) & FALSE expression (withoutselection) BARS and data are coming perfect. when used above IF() condition (withselection) data coming as expected, but (withoutselection) not working as expected(current year to till date).
Can any one help me to fix this issue...
Many Thanks in advance....
Thanks,
pratap
Did you try creating variables as I have suggested and then expression suggested in previous reply? This should work as expected if not then using your expression go to bar properties->Add-On->Data handling-> Uncheck Include zero value
No Need to write the if condition for this. You can achieve it using single expression
Create variable on front end like below
vSelectedDateYearStart
= yearstart(max([Created Date]))
vSelectedDateYearEnd
= max([Created Date])
Then you can simply use below expression
Count({<[Created Date] = {">=$(vSelectedDateYearStart)<=$(vSelectedDateYearEnd)"}>}SALES)
Hi Kush,
Thanks for your quick response.
your logic won't work, why because,
Count({<[Created Date] = {">=$(vSelectedDateYearStart)<=$(vSelectedDateYearEnd)"}>}SALES)
here, without select anything data showing from 01JAN2018(vSelectedDateYearStart) to till date(vSelectedDateYearEnd), please find the screenshot(Not working).
My requirement is there is 2018 to 2010 July data, when user select 16Jun2019 then need to display 01Jan2019 to 16Jun2019 data, if not select anything, only current year starting 01Jan2020 to Till Dates data should show....
Did you try creating variables as I have suggested and then expression suggested in previous reply? This should work as expected if not then using your expression go to bar properties->Add-On->Data handling-> Uncheck Include zero value
Hi Kush,
Thanks for your efforts.
My Expression works fine, but i missed that property AddOns-->Datamodel-->Include ZeroValues(UNCHECK)..
Thanks for your suggestion, it's working exactly, what i expected.
Thanks,
Pratap