Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
mikeslade
Contributor III
Contributor III

Chart Default 7 days unless dates are selected

Hi, hopefully someone can show me where I'm going wrong.

I have a chart that successfully shows only last 7 days based on a flag in the data using this set analysis: 
Num(Sum({< [%Last 7 Days Flag] = {"Y"}>}[Transaction Volume]), '#,##0')

What I want to do is if a date is selected, then ignore the default and display as per the selection.

I tried the below to get the evaluate selected count and then show volumes depending on the result


if(GetSelectedCount([Transaction Date]) >0,
Num(Sum([Transaction Volume]), '#,##0'),
Num(Sum({< [%Last 7 Days Flag] = {"Y"}>}[Transaction Volume]), '#,##0')
)

This works when a date is selected, however if no date is selected the set analysis that worked before now displays all dates, but only values for the last 7 days and all the non 7 day values are showing as 0 and are not nulls.

I'm confused why it would work outside of the if statement, but behave differently within it.

Here is how the chart looks with the set analysis on it's own out of the if condition

7daysworking.PNG

 

Within the if condition, this now looks like this (The last 7 days are waaay over the right 🙂 )

7daysnotworking.PNG

Anybody have an idea?

Thanks.

 

 

Labels (2)
1 Solution

Accepted Solutions
dirk_fischer
Creator
Creator

Hi Mikeslade

if you Limit your Dimension with a formula like in the attached imageLimit dimensionLimit dimension, you should get, what you're looking for.

Regards

Dirk


View solution in original post

9 Replies
settu_periasamy

Hi, 

Did you try to suppress null values in the measure?

mikeslade
Contributor III
Contributor III
Author

Thanks - I did try that, as I said in the post the strange thing is they are all showing 0 as values, and not nulls. (Interestingly, they are not actually 0, and if you select one of the dates then you it will work and show the true value.)

sunny_talwar

Just so we get this right, you are unchecking 'Include zero values' under Add-ons -> Data handling, correct?

image.png

dirk_fischer
Creator
Creator

Hi Mikeslade

if you Limit your Dimension with a formula like in the attached imageLimit dimensionLimit dimension, you should get, what you're looking for.

Regards

Dirk


View solution in original post

mikeslade
Contributor III
Contributor III
Author

Just so I get this right, that would exclude genuine zero values?

mikeslade
Contributor III
Contributor III
Author

Gah! Should have thought of that! Thanks.

I still don't quite understand why it doesn't work the way I tried originally, but thank you.

mikeslade
Contributor III
Contributor III
Author

Arggh how do I unaccept this as solution!

dirk_fischer
Creator
Creator

Hi Mikeslade

does your last post mean, your problem is still not solved?

If you click on the 3 vertical dots, it gives you a context menu, where you can remove the solution flag.

Regards

Dirk

mikeslade
Contributor III
Contributor III
Author

Oh No... you resolved, but I somehow managed to mark my own reply as a solution!! Figured it out and removed the solution against my response!

Thank you!