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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Dates measure or calculated column

Hi Experts

 

need a measure to do the following, If the date is in the past from Todays date the 1, if the date is the current month then 2, if the date is in future months/periods after the current month then 3

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

That would be like this.

Formatting = 
VAR _Date = MAX ( Dates[Date] )
RETURN
SWITCH(
    TRUE(),
    _Date <= TODAY(),1,
    _Date <= EOMONTH(TODAY(),0),2,
    3
)

2021-11-10_6-40-30.jpg

View solution in original post

4 REPLIES 4
jdbuchanan71
Super User
Super User

That would be like this.

Formatting = 
VAR _Date = MAX ( Dates[Date] )
RETURN
SWITCH(
    TRUE(),
    _Date <= TODAY(),1,
    _Date <= EOMONTH(TODAY(),0),2,
    3
)

2021-11-10_6-40-30.jpg

jdbuchanan71
Super User
Super User

@Anonymous 

You can add a calculated column like this.

 

Date Period = 
SWITCH (
    TRUE(),
    [Date] < TODAY(), 1,
    [Date] <= EOMONTH ( TODAY(), 0 ), 2,
    3
)

 

jdbuchanan71_0-1636548497566.png

 

Anonymous
Not applicable

Hi  jdbuchanan71 i am trying to use the 1,2 and 3 as conditional formatting in a clustered bar chart and its not working correct - hence why i also asked for a measure

 

Anonymous
Not applicable

thanks - how could we write the above as a measure?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors