Forum Discussion
ElvirBotic
Helper III
5 years agoTrying to build Calculated Column for Current Month and Current Year
Hello, looking to build a calculated column that will based on the date table add a new column to show three different statuses Current Month, Previous Month, and then Future Month. So, naturally for...
- Anonymous5 years ago
Hi ElvirBotic ,
Here are the steps you can follow:
1. Create calculated column.
Switch = var _currentyear=YEAR(TODAY()) var _currentmonth=MONTH(TODAY()) var _maxcurrentmonthday=EOMONTH(TODAY(),0) var _maxlastmonth=EOMONTH(TODAY(),-2) var _switch= SWITCH( TRUE(), YEAR('Table'[Date])=_currentyear&&MONTH('Table'[Date])=_currentmonth,"Current Month", YEAR('Table'[Date])=_currentyear&&MONTH('Table'[Date])=_currentmonth-1,"Previous Month", 'Table'[Date]<=_maxlastmonth,"Previous", 'Table'[Date]>_maxcurrentmonthday,"Future Month") return _switch2. Result:
Filter the data to extract representative dates to better view the results
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
ryan_mayu
Super User
5 years agois this what you want? I assume you only have one year data in date table. if you have more than one year data, you need to modify the DAX
Column = if(MONTH('Date'[Date])=month(today()),"Current Month",if('Date'[Date]<=EOMONTH(today(),-1),"Previous Month",if('Date'[Date]>EOMONTH(today(),0),"Future Month")))