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
Ashoop2020
Frequent Visitor

Creating a Calendar Table with the First date based on column value

Hello! 

 

I am looking to create a calendar table that starts with the first date in the below table where the Print Drop Column = Yes, and the last date is the last date in the below table. 

 

Screenshot 2022-12-15 101116.png

 I know how to create the table I am just not sure how to implement a condition with the "FIRSTDATE" function. 

 

Thanks!

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

Hi @Ashoop2020 ,

You can create a calculated table as below, please find the details in the attachment.

Calendar = 
VAR _mindate =
    CALCULATE ( MIN ( 'Table'[date] ), 'Table'[Print Drop] = "Yes" )
VAR _maxdate =
    CALCULATE ( MAX ( 'Table'[date] ), 'Table'[Print Drop] = "Yes" )
RETURN
    CALENDAR ( _mindate, _maxdate )

yingyinr_1-1671177178534.png

Best Regards

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

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @Ashoop2020 ,

You can create a calculated table as below, please find the details in the attachment.

Calendar = 
VAR _mindate =
    CALCULATE ( MIN ( 'Table'[date] ), 'Table'[Print Drop] = "Yes" )
VAR _maxdate =
    CALCULATE ( MAX ( 'Table'[date] ), 'Table'[Print Drop] = "Yes" )
RETURN
    CALENDAR ( _mindate, _maxdate )

yingyinr_1-1671177178534.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
WinterMist
Impactful Individual
Impactful Individual

@Ashoop2020 

 

For a sound Date Table, this is not recommended.  For date-time functions to work, DAX is very picky and demands that the date table begin on January 1st & end on December 31st.

 

Are you 100% sure this is what you want to do?

 

Regards,

Nathan

 

 

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

WinterMist_0-1671121955199.png

 

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.