Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
lcap
New Member

DAX 'Current Month'

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.  

1 ACCEPTED 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" )




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

9 REPLIES 9
v-yalanwu-msft
Community Support
Community Support

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.

PaulDBrown
Community Champion
Community Champion

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())





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Like this?

7 Reactive Report Before Current Month? = IF([Case Reported On]<MONTH(TODAY()) && YEAR(TODAY(),"Yes","No")

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?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

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"
)

prev month.png

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






I already have a similar column which is working fine - 

6 Reactive Report Before 2 Days Ago? = IF([Case Reported On]<TODAY()-2,"Yes","No")

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" )




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors