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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Edit DAX to filter out specifics dates from column

Hi,

I have some DAX that is filtering out weekends. But I also need it to filter out specifcs company holidays. He is the DAX i'm currently using. I need the dates removed from the date column.

 

dim date = 
FILTER (
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2020, 12, 31 ) ),
        "WeekDay", WEEKDAY ( [Date], 2 )
    ),
    [WeekDay] <= 5
)

 

 

Here is a picture of my two columns. I need to remove Christmas, Thanksgiving and so on. Any help is appreciated.

jghfgd.PNG

1 ACCEPTED SOLUTION

Sorry, you need a SELECTCOLUMNS in there:

 

dim date = 
EXCEPT(
  SELECTCOLUMNS(
    FILTER (
        ADDCOLUMNS (
            CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2020, 12, 31 ) ),
            "WeekDay", WEEKDAY ( [Date], 2 )
        ),
        [WeekDay] <= 5
    ),
    "Date",[Date]
  ),
  ALL('Holidays',[Date])
)


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

10 REPLIES 10
Anonymous
Not applicable

Hi @Anonymous ,

 

You will need a Holiday table. Refer the topic below about how to create Holiday table.

https://community.powerbi.com/t5/Desktop/Public-Holiday-Script/m-p/178341.

Mark the holidays and weekends then filter the tag in your formula.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

Create a Holidays table, use EXCEPT.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler,
Thanks for replying. I do have a holidays table. And whenever I try to add anything to that existing dax it breaks it. Where within that dax would I put EXCEPT?

Should be something along the lines of:

 

dim date = 
EXCEPT(
  FILTER (
      ADDCOLUMNS (
          CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2020, 12, 31 ) ),
          "WeekDay", WEEKDAY ( [Date], 2 )
      ),
      [WeekDay] <= 5
  ),
  ALL('Holidays',[Date])
)


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler ,

Thanks for reaching out so quickly. Looks like I'm still having an issue.Here are some screen shots of what's going on. I'm a bit confused. I tried two different ways. I hvae included a screen shot of the holiday table. Maybe the dim date table isn't right or something.error 1.PNGerror 2.PNGholiday.PNG

@Anonymous  my bad, it should be ALL('Holidays'[Date])



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_DecklerI did that example in the first picture I sent and got an error.error 1.PNG

Sorry, you need a SELECTCOLUMNS in there:

 

dim date = 
EXCEPT(
  SELECTCOLUMNS(
    FILTER (
        ADDCOLUMNS (
            CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2020, 12, 31 ) ),
            "WeekDay", WEEKDAY ( [Date], 2 )
        ),
        [WeekDay] <= 5
    ),
    "Date",[Date]
  ),
  ALL('Holidays',[Date])
)


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_DecklerGreg, my man! Now that I see it and how it works, it makes sense. Thanks for all you do in the community.

My apologies for all of the syntax errors! That's what happens when I try to write DAX without testing it!!



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors