cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
avioti
Frequent Visitor

Public Holiday - Script

Hello Guys

 

I have a Calendar Table and i would like to add a collumn which contains all public holidays.

Is there some script which i can use to generate it?

 

Thanks

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @avioti,

 

Current power bi not contains any script to auto generate the holiday calendar table.

 

You should get a holiday list first, for example:

1. Find out a public holiday list from web, import it to power bi.

2.PNG
2. Create a calendar table and build the relationship.

DateTable = ADDCOLUMNS(CALENDAR(DATE(2015,1,1),TODAY()),"Year",FORMAT([Date],"yyyy"),"Month",FORMAT([Date],"mmmm"),"Quarter",FORMAT([Date],"q"),"Week",WEEKNUM([Date],1),"Day Of Week",FORMAT([Date],"dddd"))

 

3. Add calculated column to check relationship.(holiday = normal holiday + public holiday)

Holiday Tag = IF(ISBLANK(RELATED(Holiday[Federal holiday]))=FALSE(),RELATED(Holiday[Federal holiday]),if([Day Of Week]="Saturday"||[Day Of Week]="Sunday",[Day Of Week],BLANK()))

3.PNG

 

 

BTW, you can also share your requirement to ideas.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
Wederley
New Member

You can find a list with more than 10 sources of public holidays all over the world in the post below. The list also contains some DimDate tables very detailed, especially for USA holidays.

 

https://www.linkedin.com/pulse/find-here-many-lists-public-holidays-wederley-m-miranda

 

 

v-shex-msft
Community Support
Community Support

Hi @avioti,

 

Current power bi not contains any script to auto generate the holiday calendar table.

 

You should get a holiday list first, for example:

1. Find out a public holiday list from web, import it to power bi.

2.PNG
2. Create a calendar table and build the relationship.

DateTable = ADDCOLUMNS(CALENDAR(DATE(2015,1,1),TODAY()),"Year",FORMAT([Date],"yyyy"),"Month",FORMAT([Date],"mmmm"),"Quarter",FORMAT([Date],"q"),"Week",WEEKNUM([Date],1),"Day Of Week",FORMAT([Date],"dddd"))

 

3. Add calculated column to check relationship.(holiday = normal holiday + public holiday)

Holiday Tag = IF(ISBLANK(RELATED(Holiday[Federal holiday]))=FALSE(),RELATED(Holiday[Federal holiday]),if([Day Of Week]="Saturday"||[Day Of Week]="Sunday",[Day Of Week],BLANK()))

3.PNG

 

 

BTW, you can also share your requirement to ideas.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi - I know this is not a recent post - but I found the solution whilst searching for an answer to an issue I had, and it has helped me out with what I needed to do. Thanks for the solution and for posting!

dkay84_PowerBI
Microsoft
Microsoft

I recommend just finding a web based source, based on your country, where you can pull in a table of dates that are holidays and then merge this with your existing date table.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors