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

Current Week + Complete Selection KPI

I have an expression which allows shows me the sum of sales for the current week. However, when I select other weeks of data the KPI always just shows the sum of sales for the latest week selected. Is it possible to write an expression show the sum of sales for everything in the selection, but at the same time when nothing is selected show the sum of sales for the current week? My current expression is below.

Sum({<YearWeek={$=max({<YearWeek={"=[Year/Week Start Date]<=$weekstart(now(),-1,0)"}>}num#(YearWeek))}>}[Sales Qty])

1 Solution

Accepted Solutions
sunny_talwar

May be this

If(Len(Trim(GetCurrentSelections())) = 0, Sum({<YearWeek={$=max({<YearWeek={"=[Year/Week Start Date]<=$weekstart(now(),-1,0)"}>}num#(YearWeek))}>}[Sales Qty]), Sum([Sales Qty]))

Basically, the above expression is saying that when no selections have been made in the dashboard, then show the result of this expression

Sum({<YearWeek={$=max({<YearWeek={"=[Year/Week Start Date]<=$weekstart(now(),-1,0)"}>}num#(YearWeek))}>}[Sales Qty])

But as soon as selections are made, display the result of this expression

Sum([Sales Qty])

View solution in original post

2 Replies
sunny_talwar

May be this

If(Len(Trim(GetCurrentSelections())) = 0, Sum({<YearWeek={$=max({<YearWeek={"=[Year/Week Start Date]<=$weekstart(now(),-1,0)"}>}num#(YearWeek))}>}[Sales Qty]), Sum([Sales Qty]))

Basically, the above expression is saying that when no selections have been made in the dashboard, then show the result of this expression

Sum({<YearWeek={$=max({<YearWeek={"=[Year/Week Start Date]<=$weekstart(now(),-1,0)"}>}num#(YearWeek))}>}[Sales Qty])

But as soon as selections are made, display the result of this expression

Sum([Sales Qty])

eaphymaoweave
Contributor II
Contributor II
Author

Thank you! Works perfectly