Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have a core variable (vCurrentSales) defined using set analysis and I don't want to have to recalculate it every time simply to add different filters. Is it possible to pass another variable to it such as a date filter?
Here's an example of the core variable:
vCurrentSales = Sum({$<[Category]={"eCommerce"}>}sale_quantity)
And I want to be able to pass a filter to it, something like this:
vMonthStart = vMonthStart = monthstart(Date(Floor(localtime('New York')) - 1, 'YYYY-MM-DD'))
Here's an example. It runs and doesn't error, but it doesn't actually filter vCurrentSales to the MonthStart. I've tried dimension filters as well and those also don't work. Any suggestions?
vCurrentSalesThisMonth=$(vCurrentSales({$<[Sales Date]={'>=$(=vMonthStart)'}>}))
You could try this.
vCurrentSales = Sum({$<[Category]={"eCommerce"} $1>}sale_quantity)
vMonthStart = monthstart(Date(Floor(localtime('New York')) - 1, 'YYYY-MM-DD'))
vCurrentSalesThisMonth=$(vCurrentSales([Sales Date]={">=$(=vMonthStart)"}))
May be like this :
Sum({<sale_quantity = {"$(=$(vCurrentSales))"}, [Sales Date]={">=$(=vMonthStart)"}>}Field1)
OR
Sum({<sale_quantity = {"=$(=vCurrentSales)"}, [Sales Date]={">=$(=vMonthStart)"}>}Field1)