Forum Discussion
Previousday function problem
- 6 years ago
RobertKuij , that will work better a Measure for a new column try
new column = sumx(filter(table, table[date]=earlier(table[date])-1),[closing])
Use last, not the yesterday's date
last Date= maxx(filter(table, table[date]<earlier(table[date])),[date])
new column = sumx(filter(table, table[date]=earlier(table[last date])-),[closing])Measure can be like
Last Day Non Continous = CALCULATE(sum('order'[Qty]),filter(all('Date'),'Date'[Date] =MAXX(FILTER(all('Date'),'Date'[Date]<max('Date'[Date])),Table['Date'])))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
RobertKuij , that will work better a Measure for a new column try
new column = sumx(filter(table, table[date]=earlier(table[date])-1),[closing])
Use last, not the yesterday's date
last Date= maxx(filter(table, table[date]<earlier(table[date])),[date])
new column = sumx(filter(table, table[date]=earlier(table[last date])-),[closing])
Measure can be like
Last Day Non Continous = CALCULATE(sum('order'[Qty]),filter(all('Date'),'Date'[Date] =MAXX(FILTER(all('Date'),'Date'[Date]<max('Date'[Date])),Table['Date'])))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
Thanks that really helped!
I do have an additional question. These measures would only be useful for one query right? As I have to add another 39 stocks into my dashboard, this would mean I have to create these measures for every stock. Is it possible to create a column in the Power Query Editor so that making these measures for every new stock would not be necessary?