Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Filtering a Chart by Date Selection Stored in a Variable

Hi All,

I have an issue getting a date variable that's being fed it's value through a calendar object to filter charts by it's value. The variables are vMinDate and vMaxDate. This is the calculated dimension i'm using to filter the chart by the vMinDate information (the chart is titled Make__c. Screen shot attached):

= if(SnapshotDate = date($(vMinDate)) , SnapshotDate)

As you can see in the below screenshot, this is causing a null value to be returned.


Any suggestion on filtering a chart by passing the value stored in a variable into a field selection?

Thanks a lot,

Ron

1 Solution

Accepted Solutions
sunny_talwar

Date() function just changes the representation of the field, but it won't change the underlying value. To change the underlying value, you need to use Floor function.

What about this -> =If(Num(Floor(SnapshotDate)) = Num(Floor($(vMinDate))), SnapshotDate)

If that does not work either, would you be able to share a small sample?

View solution in original post

4 Replies
sunny_talwar

Try this:

=If(Num(SnapshotDate) = Num(Floor($(vMinDate)), SnapshotDate)

Your vMinDate is actually a timestamp which probably isn't matching with SnapshotDate. But Floor will remove the time part and will just match them on the Date.

Anonymous
Not applicable
Author

Hi Sunny,

=If(Num(SnapshotDate) = Num(Floor($(vMinDate))), SnapshotDate) still returns null. I did see that the value of the variable is not formatted as a date, like the SnapshotDate field. I was hoping to fix that by using Date() in the declaration. It doesn't seem to want to take.

Thanks

sunny_talwar

Date() function just changes the representation of the field, but it won't change the underlying value. To change the underlying value, you need to use Floor function.

What about this -> =If(Num(Floor(SnapshotDate)) = Num(Floor($(vMinDate))), SnapshotDate)

If that does not work either, would you be able to share a small sample?

Anonymous
Not applicable
Author

Thanks, Sunny!