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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
learning_dax
Helper II
Helper II

Calculate Year/Month Filters not working

Hi all, 

I'm using SampleSupterstore dataset and I'm trying to calculate orders only placed in 2016 (Order Date in 2016). I figured out that I had to use the YEAR function as a filter when using the CALCULATE function; however, when I try to get more granular and filter year 2016 in the months of January and February combined, I receive blank values. Does anyone know why this happens? P.S. I'm also using a Date table as well. Here is the function I tried that did not work:

CALCULATE([TotalSales],YEAR('Date'[Date]) = 2016,'Date'[Month Name] = "January" && 'Date'[Month Name] = "February")
1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi again,

Now that you are using && you are trying to apply the filters simultaniously the sign for or is ||
Alternatively you can just use OR()

So try this:

CALCULATE([TotalSales],YEAR('Date'[Date]) = 2016,'Date'[Month Name] = "January" || 'Date'[Month Name] = "February")

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
ValtteriN
Super User
Super User

Hi again,

Now that you are using && you are trying to apply the filters simultaniously the sign for or is ||
Alternatively you can just use OR()

So try this:

CALCULATE([TotalSales],YEAR('Date'[Date]) = 2016,'Date'[Month Name] = "January" || 'Date'[Month Name] = "February")

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.