Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
loganathan
Contributor II
Contributor II

Set analysis expression for min and max date by default

Hi All,

i need a chart calculation which is sum (sales) has to shown for latest 10 days by default if there is no date selection made. if any date selection done then show accordingly. attached the sample data. Please help. 

 

TIA

Labels (2)
1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Apologies, I forgot to save the file.

Here is the saved one.

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

10 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this,

Sum({<Date = {">=$(=Max(Date)-10)"}>}Sales)

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
loganathan
Contributor II
Contributor II
Author

Hi Kaushik,

 

Thanks and yes this is working fine. But the problem is. i have 10 fields in the data file. when user opening the dashboard there wont be any selections. if during that time only i want to latest 10 days data in my chart if started selecting the fields then my measure must show the values as per the selection.

Eg: i want my expression is something like this

if ("no filter selected" then Sum({<Date = {">=$(=Max(Date)-10)"}>}Sales) else sum(Sales))

 

not sure how to get the red colour expression

 

TIA

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

In such case, you can create a variable say vFilter

vFilter will have an expression like below.

=If(GetSelectedCount(Date)=0,'<Date = {">=$(=Date(Max(Date)-10))"}>','$')

And use this in the expression like below.

Sum({$(vFilter)}Sales)

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
loganathan
Contributor II
Contributor II
Author

Hi Kaushik,

 

Thanks for your prompt reply. this one gives me '0' values. i am not sure how to call the variable in set analysis. 

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Here is the qvf file for your reference.

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
loganathan
Contributor II
Contributor II
Author

Hi Kaushik,

no sheet in your qvf and attached the qvf with sheets which has no values in sales measure (Variable measure).

 

PFA

loganathan
Contributor II
Contributor II
Author

hi kaushik,

 

Actually, the below expression is working fine. but if user selection is not from the date then its not working.

 =If(GetSelectedCount(Date)=0,sum({<Date = {">=$(=Max(Date)-10)"}>}sales),sum(sales))

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Apologies, I forgot to save the file.

Here is the saved one.

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
loganathan
Contributor II
Contributor II
Author

Hi Kaushik,

its not working if i check year and month field. update the file with extra data as attached. please refer bookmark for my selection.

loganathan_0-1593879823244.png