Forum Discussion
Anonymous
6 years agoNot applicable
Sum previous Month and current year return wrong numbers
Hi All, I have two tables (UserActions & Date). Auto date/time is disabled. I want to create a simple measures but with no success. Calculate YTD (Current Year) sum of t_UserActions (disregard al...
- 6 years ago
Anonymous
Try like
Measure pervious month = var _max = eomonth(date(year(today()),month(today())-1,year(today())),0) var _min = date(year(today()),month(today())-1,1) Return calculate(countrows(t_UserActions),all(date),date[Date]<=_max && date[date]>= _min,all(t_UserActions)) Measure since Start of year = var _min=date(year(today()),1,1) var _max =today() Return calculate(countrows(t_UserActions),all(date),date[Date]<=_max && date[date]>= _min,all(t_UserActions))all(date) will remove date filter. all(t_UserActions) will all filter on this table
So use all(t_UserActions), only as per need
Anonymous
6 years agoNot applicable
Thanks for your prompt reply.
The issue I still have is the total sum changed when filter on the page is selected. I want two cards in the page last month transactions (t_UserActions) and total transactions since begining of the year --> and these cards should not change when selecting a filter.
Many thx,
Guy
amitchandak
6 years agoSuper User
Anonymous
Try like
Measure pervious month =
var _max = eomonth(date(year(today()),month(today())-1,year(today())),0)
var _min = date(year(today()),month(today())-1,1)
Return
calculate(countrows(t_UserActions),all(date),date[Date]<=_max && date[date]>= _min,all(t_UserActions))
Measure since Start of year =
var _min=date(year(today()),1,1)
var _max =today()
Return
calculate(countrows(t_UserActions),all(date),date[Date]<=_max && date[date]>= _min,all(t_UserActions))
all(date) will remove date filter. all(t_UserActions) will all filter on this table
So use all(t_UserActions), only as per need
- Anonymous6 years agoNot applicable
amitchandak Thousand thanks!