Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to create a chart where data is displayed only for future dates
i.e. Dates> today()
How do I write an expression to achieve this?
I tried something like Date > Date(today(),'YYYY-MM-DD')
This did not work.
Please suggest a solution
Thanks
Just to add to the previous post- The expression is to be added in the dimension section of a bar chart.
May be like this in your calculated dimension:
If(Dates >Today(), Dates)
Make sure to check 'Suppress When Value Is Null' on the dimension tab
Another thing to note here is that your Dates field need to be read as dual in order for this to work. Use Date#() in the script to make sure Dates are read as dual if they are not. Check the following links for more help on this topic
Ensure that date formats are compatible on both side of the operator.
AFAIK, If statement do not require you to have same formats. Its only an issue when using set analysis
Hi Soumya,
It might be work for your future date.
Date(Today()+1,'DD/MM/YYYY')
oh ok, thanks for pointing it out.
Thank you for the replies.
I applied a condition as (given below) on the measure and the chart now displays values only for future dates
=Sum( If ( DATE>Date(today(),'YYYY-MM-DD') , Sales))
You can replicate this using set analysis as well:
=Sum({<DATE *= {"=$(='>' & Date(Today(),'YYYY-MM-DD'))"}>} Sales)
To filter based on selection in DATE selected
or
=Sum({<DATE = {"=$(='>' & Date(Today(),'YYYY-MM-DD'))"}>} Sales)
To always display future dates based on selection in DATE field