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
Anonymous
Not applicable

Matching dates to a holiday table

I have a column that contains dates that cases were opened - 'Cases'[CreatedDate] with a date/time format of 12/26/2016 5:56:17 PM

 

In a second table I have all corporate holidays listed - 'Holidays'[Holiday Date] with a date format of 12/16/2016

 

I want to build a calculated column that identifies matching dates and produces a result of "True" in the column if the CreatedDate matches a Holiday Date. 

 

I built a relationship between the values and was able to get a column to show the date, but can't figure out how to build the matching output I'm trying to get.

 

 

 

 

 

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

Hi @Anonymous

“I built a relationship between the values and was able to get a column to show the date”

Do you mean “built a relationship between the values” instead of building a relationship on the date column?

Does the following example do as you said?

1.png2.png

3.png

Then with a DAX, I can lookup “Holiday” based on “value” as follows.

Next, identify matching dates and produce a result of "True"

4.png

Column = LOOKUPVALUE(Holidays[Holidays],'Cases'[CreatedDate],[CreatedDate])
flag = IF([Column]=[CreatedDate],"true",BLANK())

Best Regards

Maggie

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

“I built a relationship between the values and was able to get a column to show the date”

Do you mean “built a relationship between the values” instead of building a relationship on the date column?

Does the following example do as you said?

1.png2.png

3.png

Then with a DAX, I can lookup “Holiday” based on “value” as follows.

Next, identify matching dates and produce a result of "True"

4.png

Column = LOOKUPVALUE(Holidays[Holidays],'Cases'[CreatedDate],[CreatedDate])
flag = IF([Column]=[CreatedDate],"true",BLANK())

Best Regards

Maggie

MattAllington
Community Champion
Community Champion

There is a lot to learn and do. 

 

Remove the time portion from your column

create a calendar table. https://exceleratorbi.com.au/power-pivot-calendar-tables/

Join both current tables to be calendar table, then use the calendar table date column and not the other date columns https://exceleratorbi.com.au/relationships-power-bi-power-pivot/

dont Write a calculate column https://exceleratorbi.com.au/calculated-columns-vs-measures-dax/

 

depending on what you are trying to do, you could then creat a matrix using calendar date on rows, then pull in the count of cases and the holiday flag. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

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.