Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasshana
Creator II
Creator II

selection of a week has to display previous weeks sales

Hi,

I do have the below example data in my application.

Year Week Sales
2020 1 100
2020 2 200
2020 3 300
2020 4 400
2021 1 620
2021 2 150
2021 3 200
2021 4 300
2021 5 500

 

My requirement is if is select year it has to be sum of sales for that particular year and if is select year and week sum of sales has to be previous weeks sales.

For example: If I select 2020 from year sum(sales) 1000, if I select 2020 and week 4 sum(sales) has to be 600 and if I don't select any thing sum(sales) has to be completed years value i.e. 2700. Any idea how to achieve this in set analysis.

Regards,

Vikas

1 Reply
MarcoWedel

maybe something like

=If(GetSelectedCount(Year)=1 and GetSelectedCount(Week)=1,
    Sum({$<Week={"<$(=Week)"}>} Sales),
    Sum(Sales))

?