Forum Discussion
SSAS tabular cube previous month data
- 6 years ago
Hi Anonymous ,
Sorry, please update the measure as below.
Total Previous Month = VAR pre = EDATE ( MAX('DIM_REVENUE'[date]), -1 ) VAR preym = FORMAT ( pre, "mmm yyyy" ) RETURN CALCULATE ( SUM ( DIM_REVENUE[Revenue] ), FILTER ( ALLSELECTED(DIM_REVENUE), DIM_REVENUE[Month Name] = preym ) )Pbix as attached.
- Anonymous6 years ago
You should create date table and mark it as date table. This table should contain a continious set of dates (no gaps). See: https://docs.microsoft.com/en-us/power-bi/desktop-date-tables. You could also create the date table using DAX, for example with: https://docs.microsoft.com/en-us/dax/calendarauto-function-dax.
This is an example you can use if you create a new table:
DateTable = CALENDARAUTO()
If you've created this date table (and linked it to your table with totals) you can use time intelligence functions such as YTD or PREVIOUSMONTH. In your case you could solve your question by using PREVIOUSMONTH. See the example below:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PREVIOUSMONTH('DateTable'[Date]))
Hi Larssb,
Thanks a lot for you resonding and upates. below are my findings
i have tried with suggestion provide using DIMTable= Calenderauto(12) and mark table as Date.
used most of the time intelligence function and all measure are showing blank. would you please help in suggesting other ways.
Regards,
Snkm