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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kari1282
Helper III
Helper III

month and Year

Hi i'm trying to calculate Pro Bono Hours of the current month and year.

 

I originally had the below formula, but that required me to update every month.

 

MTD Billable = CALCULATE([Pro Bonos],FILTER('Work Date','Work Date'[Calendar Year]="2021" && 'Work Date'[Calendar Month]="August"))

 

So I wrote the below formula however, it isn't  working. any assistance would be helpful.

 
MTD Pro Bono = CALCULATE([Pro Bono],FILTER('Work Date','Work Date'[Calendar Year]=YEAR(TODAY() && 'Work Date'[Calendar Month]=MONTH(TODAY())))) 
 
Thanks
2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@kari1282 Your parens are wrong:

MTD Pro Bono = 
  CALCULATE(
    [Pro Bono],
    FILTER(
      'Work Date',
      'Work Date'[Calendar Year]=YEAR(TODAY()) && 
      'Work Date'[Calendar Month]=MONTH(TODAY())
    )
  ) 

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

@kari1282 Try:

MTD Pro Bono = 
  CALCULATE(
    [Pro Bono],
    FILTER(
      'Work Date',
      'Work Date'[Calendar Year]=YEAR(TODAY()) && 
      'Work Date'[Calendar Month]=FORMAT(TODAY(),"mmmm")
    )
  ) 

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@kari1282 Your parens are wrong:

MTD Pro Bono = 
  CALCULATE(
    [Pro Bono],
    FILTER(
      'Work Date',
      'Work Date'[Calendar Year]=YEAR(TODAY()) && 
      'Work Date'[Calendar Month]=MONTH(TODAY())
    )
  ) 

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

 

Hi Greg, 

 

Thank you I've updated the measure but recieved the below error

 

kari1282_0-1629394493490.png

 Is it because the 'Work Date'[Calendar Month] is listed as August and not 8

Hi,  @kari1282 

Could you please tell me whether your problem has been solved?

If yes, you could accept the helpful answer as solution. 
For now, there is no content of description in the thread. If you still need help, please share more details.

 

Best Regards,
Community Support Team _ Eason

@kari1282 Try:

MTD Pro Bono = 
  CALCULATE(
    [Pro Bono],
    FILTER(
      'Work Date',
      'Work Date'[Calendar Year]=YEAR(TODAY()) && 
      'Work Date'[Calendar Month]=FORMAT(TODAY(),"mmmm")
    )
  ) 

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.