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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anders_G
Helper I
Helper I

IF formula using DATE with only MM-DD

 

I'm using an IF formula to determine if TODAY() is within the Current quarter or if it lies in the Past or Future.

 

The limitation to my formula is that I will have to update the YEAR once a year. I would like to prevent that.

 

Question : How do I exclude the YEAR variable from this formula? I want it to only look at MONTH and DAY.

 

Q1 Check = IF ( DATE(2022,4,1) <= TODAY() && DATE(2022,6,30) >= TODAY(), "Current", IF ( DATE(2022,6,30) > TODAY(), "Future", IF ( DATE(2022,4,1) < TODAY(), "Past")))
 
Thank You!
4 REPLIES 4
Anonymous
Not applicable

Hi  @Anders_G ,

I created some data:

TableA:

vyangliumsft_0-1661757222189.png

TableB:

vyangliumsft_1-1661757222190.png

Here are the steps you can follow:

1. Create calculated table.

vyangliumsft_2-1661757222192.png

Table =
CALENDAR(
    DATE(2022,1,1),
    DATE(2022,12,31))

Create calculated column.

Qu = QUARTER('Table'[Date])

vyangliumsft_3-1661757222193.png

2. Create measure.

Measure =
var _today=TODAY()
var _Qud=
CALCULATE(MAX('Table'[Qu]),FILTER(ALL('Table'),'Table'[Date]=_today))
var _minQudate=
MINX(FILTER(ALL('Table'),'Table'[Qu]=_Qud),[Date])
var _maxQudate=
MAXX(FILTER(ALL('Table'),'Table'[Qu]=_Qud),[Date])
return
IF(
    _today<_minQudate,
    SUMX(FILTER(ALL(TableA),MONTH('TableA'[Date])=MONTH(_today)),[Amount])
    ,
    SUMX(FILTER(ALL(TableB),MONTH('TableB'[Date])=MONTH(_today)),[Amount]))

3. Result:

vyangliumsft_4-1661757222193.png

 

If you need pbix, please click here.

IF formula using DATE with only MM-DD.pbix

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hi Liu, thanks for taking your time!

 

If I understand the Measure correct it is looking at the dates of the two tables  and is picking this month's values from table B, which is 10.

 

What I want to have is a measure or some other way to look at today's date, compare it with the dates in tables A & B and if the those dates are from a Quarter in the past the values from Table A should be used and if the dates are in the current or future Quarters they should look at Table B. So the table from your pbix should look like in the screenshot below.

 

Anders_G_0-1661776771606.png

 

amitchandak
Super User
Super User

@Anders_G , You can have a new column like

 

Qtr flag =

var _today = today()
var _max = eomonth(_today, if( mod(Month(_today),3) =0,0,3-mod(Month(_today),3)))
var _min = eomonth(_max,-3)+1

return

Switch( True() ,

[Date] <_min , "Past" ,

[Date] > _max, "Future",

"Current"

)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you. But I'm not sure adding a column will work. 

 

I have two tables. One for the Past and one for Current and Future. In my dashboard I'm replacing the "Past", "Current" and "Future" text in my example with measures that will sum values depending on the IF formula.

 

If the formula returns "Past" it uses my measure for Table A. If it returns either "Current" or "Future" it uses the measure for Table B.

 

would that change the solution?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.