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

show value based on current date

Hello,
I have a Date table with columns such as DateKey, PreviousWorkingDateKey, etc.
I would like to have a measure which shows the previousWorkingDateKey for today's DateKey
How is ithis done please?
Thank you

1 ACCEPTED SOLUTION

HI  @Anonymous 

If so, just adjust the formula as below:

Measure 2 = 
var _preworkingdatekey= calculate(max('Date'[PreviousWorkingDate]),filter('Date','Date'[DateValue] = today())) return
DATE(VALUE(LEFT(_preworkingdatekey,4)),VALUE(MID(_preworkingdatekey,5,2)),VALUE(RIGHT(_preworkingdatekey,2)))

 

Regards,

Lin

Community Support Team _ Lin
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

9 REPLIES 9
Anonymous
Not applicable

Hi @Anonymous ,

 

I'm not sure your data key format, so you can change the format in the below measure to suit your type:

 

Measure = calculate(max(perviousworkingdatekey),filter(date_table,datekey = today()))

 

Please try.

Aiolos Zhao

Anonymous
Not applicable

Measure =

= calculate(max('Date'[Previous Working Date Key]),filter('Date','Date'[Value] = today()))
Previous Working Date key is in integers
Date Key is in integers
Date Value is in Date
The above measure shows 20M rather than date.
Do you know why?
Thank  you

HI  @Anonymous 

If so, just adjust the formula as below:

Measure 2 = 
var _preworkingdatekey= calculate(max('Date'[PreviousWorkingDate]),filter('Date','Date'[DateValue] = today())) return
DATE(VALUE(LEFT(_preworkingdatekey,4)),VALUE(MID(_preworkingdatekey,5,2)),VALUE(RIGHT(_preworkingdatekey,2)))

 

Regards,

Lin

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

My previous post saying it shows (Blank) was wrong.
It actually shows 20M whereas it should show a date.
Any thoughts please?

Thank you

@Anonymous , does you date has a timestamp in it , if so create a date column

 

Date = [Datetime].date

 

then join it with date table and filter for today.

 

calculate(sum(Table[value]), filter(Date, Date[Date]=Today()))

 

Make sure you have data for today

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

could you please show some sample data and the result you want?

 

Anonymous
Not applicable

sample data

 

DateKey       DateValue        PreviousWorkingDate
20140306 2014-03-06     20140305
20140307 2014-03-07     20140306

 

so if today's date is, say, 7th march 2014 then the measure should show the [date value] which represents the [previousworkingDate ]= 20140306
 

Thank you

Anonymous
Not applicable

@Anonymous 

 

show value based on current date.PNG

 

Measure 6 = CALCULATE(MAX(Account[PREVIOUSWORKING]),Account[DATEVALUE] = TODAY())

 

Aiolos Zhao

Anonymous
Not applicable

it shows (Blank)

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