Forum Discussion
Public Holiday - Script
- Anonymous9 years ago
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. 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()))
BTW, you can also share your requirement to ideas.
Regards,
Xiaoxin Sheng
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. 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()))
BTW, you can also share your requirement to ideas.
Regards,
Xiaoxin Sheng
Hi, you might take a look here if you need to do it with Power Query instead of dax. I put it here if someone has the same issue. https://github.com/FotMac/powerquery-public-holidays-gr