Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hiya,
I'm struggling to work out how to formulate a column with an IF statement - i'm stuck how to express Current Month.
Thanks in advance.
Solved! Go to Solution.
Try:
Before current month =
VAR _YMToday =
YEAR ( TODAY () ) * 100
+ MONTH ( TODAY () )
VAR _YMField =
YEAR ( MAX ( 'Dates Table'[Date] ) ) * 100
+ MONTH ( MAX ( 'Dates Table'[Date] ) )
RETURN
IF ( _YMField = _YMToday, "Current month" )
Proud to be a Super User!
Paul on Linkedin.
Hi, @lcap ;
If it is less than the end of the current month:
7 Reactive Report Before Current Month? =
IF ( [Case Reported On] <= EOMONTH ( TODAY (), 0 ), "Yes", "No" )
If it is less than the start of the current month:
7 Reactive Report Before Current Month? =
IF ( [Case Reported On] <= EOMONTH ( TODAY (), -1 ), "Yes", "No" )
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
for current month use
MONTH(TODAY()) && YEAR(TODAY())
So if have a date table, the expression would be
... 'Date Table'[Month] = MONTH(TODAY()) && 'Date Table'[Year] = YEAR(TODAY())
Proud to be a Super User!
Paul on Linkedin.
Like this?
See my previous post: I edited it to be more precise....
7 Reactive Report Before Current Month? = IF([Case Reported On]<MONTH(TODAY()) && YEAR(TODAY(),"Yes","No")
You need to compare a month field with MONTH(TODAY()) and a year field with YEAR(TODAY()).
What is your [Case reported on] measure returning?
Proud to be a Super User!
Paul on Linkedin.
[Case reported on] is a date field.
Actually the code I posted will not return previous dates in previous years which are > MONTH (TODAY()).
So you can either use:
Before current month =
VAR _YMToday = YEAR(TODAY()) * 100 + MONTH(TODAY())
VAR _YMField = YEAR(MAX('Dates Table'[Date])) * 100 + MONTH(MAX('Dates Table'[Date]))
RETURN
IF(_YMField < _YMToday, "Previous")
or
Alternative =
IF (
MAX ( 'Dates Table'[Date] )
< STARTOFMONTH (
FILTER ( ALL ( 'Dates Table'[Date] ), 'Dates Table'[Date] = TODAY () )
),
"Alternative"
)
Proud to be a Super User!
Paul on Linkedin.
I already have a similar column which is working fine -
THank you so much.
Is there a simple way to use an IF statement to say wether its in the current month?
Try:
Before current month =
VAR _YMToday =
YEAR ( TODAY () ) * 100
+ MONTH ( TODAY () )
VAR _YMField =
YEAR ( MAX ( 'Dates Table'[Date] ) ) * 100
+ MONTH ( MAX ( 'Dates Table'[Date] ) )
RETURN
IF ( _YMField = _YMToday, "Current month" )
Proud to be a Super User!
Paul on Linkedin.
| User | Count |
|---|---|
| 56 | |
| 39 | |
| 37 | |
| 21 | |
| 19 |
| User | Count |
|---|---|
| 140 | |
| 102 | |
| 63 | |
| 36 | |
| 35 |