Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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])
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])
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])
Thank you! Works perfectly