# App Development

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save \$300 before February 6: REGISTER NOW!
cancel
Showing results for
Did you mean:
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

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

Anybody have an idea?

Thanks.

Labels (1)
• ### Set Analysis

1 Solution

Accepted Solutions
Creator

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

Regards

Dirk

9 Replies
Master III

Hi,

Did you try to suppress null values in the measure?

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.)

MVP

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

Creator

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

Regards

Dirk

Contributor III
Author

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

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.

Contributor III
Author

Arggh how do I unaccept this as solution!

Creator

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

Regards

Dirk

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!

Tags
Community Browser