Forum Discussion
vinodDrinkPak
2 years agoHelper II
default dropdown date to current month
Hi Experts
default value of my end of month Dropdown is 'All", i want to have a dynamic way to always have the selected default value as current month, how do i achieve this?
My date table using a DAX logic
Dates(Disconnected)M =
FILTER(DISTINCT(LOCATION_INVENTORY[End of Month]),NOT(ISBLANK(LOCATION_INVENTORY[End of Month])))
4 Replies
- JoeBarrySolution Sage
Please try
In your date table add a new column
Current Month = if(Month('DIM Date'[Date]) = MONTH(TODAY()) ,1, 0)Add a slicer with the normal date column in it. in the filter bar add the new column and choose filter type Basic filtering and choose 1 and apply filter
Thanks
Joe
If this post helps, then please Accept it as the solution
- vinodDrinkPakHelper II
with that approach i will only be able to see current month dropdown, i just want to keep the Current month as default and still show all the previous months, see below based on the logic you shared
- vinodDrinkPakHelper II
i figured out a way
Current Month =VAR CurrentMonth = MONTH(TODAY())VAR CurrentYear = YEAR(TODAY())VAR DateMonth = MONTH('Dates(Disconnected)M'[End of Month])VAR DateYear = YEAR('Dates(Disconnected)M'[End of Month])RETURNIF(DateMonth = CurrentMonth && DateYear = CurrentYear, "Current Month", FORMAT('Dates(Disconnected)M'[End of Month], "mmm-yy"))CustomSort =VAR CurrentMonthValue = 1000VAR CurrentMonthYear = YEAR(TODAY())VAR MonthToEndYear = YEAR('Dates(Disconnected)M'[End of Month])VAR MonthToEndMonth = MONTH('Dates(Disconnected)M'[End of Month])VAR MonthsDifference = (CurrentMonthYear - MonthToEndYear) * 12 + (MONTH(TODAY()) - MonthToEndMonth)RETURNCurrentMonthValue - MonthsDifferencei used 2 logics and it resolved