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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Dates between giving unexpected response

Good morning, I have a table with a column with continuous dates between today and 2 years ago. 

 

I am trying to use the code below to create a table with time periods. My intent is to create a column where dates from today to 1 year ago are given a label, and dates from 1 year ago to 2 years, are given another label.

 

My code returns a blank table.

 

Can someone point me in the right direction on how to fix this?

 

Date Periods =
UNION(
    ADDCOLUMNS(
        DATESBETWEEN(MyDate[Date],TODAY(),TODAY()-365),
        "Type", "Asset 1 Year"
    ),
    ADDCOLUMNS(
        DATESBETWEEN(MyDate[Date],TODAY()-366,TODAY()-731),
        "Type", "Vendor 2 Year"
    )
)
 
I look forward to hearing back from you.
1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

Hi @Anonymous 
Please try

Date Periods =
ADDCOLUMNS (
    CALENDAR ( TODAY () - 730, TODAY () ),
    "Type",
        IF ( [Date] < TODAY () - 365, "Vendor 2 Year", "Asset 1 Year" )
)

View solution in original post

5 REPLIES 5
tamerj1
Community Champion
Community Champion

Hi @Anonymous 
Please try

Date Periods =
ADDCOLUMNS (
    CALENDAR ( TODAY () - 730, TODAY () ),
    "Type",
        IF ( [Date] < TODAY () - 365, "Vendor 2 Year", "Asset 1 Year" )
)
Anonymous
Not applicable

@tamerj1 Thank you for your time in getting this for me. Will this table only hold 2 years worth of dates and each new day, the table will recalculate itself and the last date disappears?

 

Lola

@Anonymous 
Exactly

BeaBF
Super User
Super User

@Anonymous Hi!

Try with:
Date Periods =
UNION(
ADDCOLUMNS(
FILTER(MyDate, MyDate[Date] >= TODAY() && MyDate[Date] < TODAY() - 365),
"Type", "Asset 1 Year"
),
ADDCOLUMNS(
FILTER(MyDate, MyDate[Date] >= TODAY() - 365 && MyDate[Date] < TODAY() - 730),
"Type", "Vendor 2 Year"
)
)

 

BBF

Anonymous
Not applicable

@BeaBF 

Thank you for the response, once again I get a blank table.

 

here is the code for my date table if that helps, it is just dates, unsummarized, formatted in DD/MM/YYYY (Short Date)

 

MyDate =
CALENDAR(
    min(Historic1[Date]),
    MAX(Historic1[Date])
)
Ive done similar things before but using previousqtr or previous month in place of the datesinbetween, but this seems to not work. I apprecaite the response, thank you
 
Lola

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.