Forum Discussion
deb_power123
4 years agoHelper V
Date table using calculated measures and columns
Hi All, I need to create a Date Table [Data Table] using any possible DAX measures or DAX calculated columns. I need the output in the below expected format.Please suggest. so I basically wan...
- 4 years ago
deb_power123 , try like
Date2 = var _1 = ADDCOLUMNS( CALENDAR(date(2019,01,01), date(2021,12,31) ), "Year", year([date]) , "Month Start Date", eomonth([date],-1)+1, "Month End Date", eomonth([date],0), "Month", format([DAte],"MMMM"), "Previous Month Start Date", eomonth([date],-2)+1, "Previous Month End Date", eomonth([date],-1), "Previous Month", format(eomonth([date],-1),"MMMM")) return SUMMARIZE(_1,[Year],[Month Start Date],[Month End Date],[Month],[Previous Month],[Previous Month Start Date],[Previous Month End Date])if needed you can simply return _1 , no need of summarize
deb_power123
4 years agoHelper V
Hi amitchandak It worked perfect but I want to know , what change should I make to your above formula to show data for 2021 year and 2020 year as well.
As in current formula it shows only for 2022 year but what if I want to show for 2019,2020, 2021..could you please suggest?
amitchandak
4 years agoSuper User
deb_power123 , try like
Date2 = var _1 = ADDCOLUMNS( CALENDAR(date(2019,01,01), date(2021,12,31) ), "Year", year([date]) , "Month Start Date", eomonth([date],-1)+1, "Month End Date", eomonth([date],0), "Month", format([DAte],"MMMM"), "Previous Month Start Date", eomonth([date],-2)+1, "Previous Month End Date", eomonth([date],-1), "Previous Month", format(eomonth([date],-1),"MMMM"))
return SUMMARIZE(_1,[Year],[Month Start Date],[Month End Date],[Month],[Previous Month],[Previous Month Start Date],[Previous Month End Date])
if needed you can simply return _1 , no need of summarize