Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have this range of dates that are at the row level. Each date represents another field that was updated. It also has future dates as the fields have scheduled updates.
I would like to get the following measures:
Starting Value: This is easy because we can just use FIRSTDATE to grab that.
Current Value: This is where I am struggling. Using LASTDATE does not work because it will grab the highest date in the column (2023) but we want the LASTDATE from NOW() using the Now function as a ceiling for the lastdate function. The ideal value it would return is the 2021 row, because January 2021 is the most recent date.
Note: Using any YEAR calculations may not work with the rest of the data as some things change once a year like with this example, but also it could change every couple months.
Solved! Go to Solution.
@drew_darke Right, you have to use proper syntax for SELECTEDCOLUMNS, I just used ... because I didn't know your columns and am lazy. So, something like:
Current Value = CALCULATE(MAX(Table[Value]), LASTDATE((SELECTCOLUMNS(FILTER(Table, Table[Date] <= NOW()),"Date",[Date])))
@drew_darke or something like this
Last date measure =
CALCULATE ( MAX ( Table[Date] ), ALLSELECTED ( Table ), Table[Date] <= NOW() ) )
✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @drew_darke
Try this measure.
Measure = CALCULATE(MAX('Table'[Value]), LASTDATE(CALCULATETABLE(VALUES('Table'[Date]),FILTER('Table','Table'[Date]<NOW()))))
If this measure still couldn't help you solve your problem, please share a sample with me without sensitive data by your Onedrive for Business.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @drew_darke
Try this measure.
Measure = CALCULATE(MAX('Table'[Value]), LASTDATE(CALCULATETABLE(VALUES('Table'[Date]),FILTER('Table','Table'[Date]<NOW()))))
If this measure still couldn't help you solve your problem, please share a sample with me without sensitive data by your Onedrive for Business.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@drew_darke or something like this
Last date measure =
CALCULATE ( MAX ( Table[Date] ), ALLSELECTED ( Table ), Table[Date] <= NOW() ) )
✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@drew_darke Can you not just use LASTDATE(SELECTCOLUMNS(FILTER('Table',[Date]<NOW())...))
@drew_darke Right, you have to use proper syntax for SELECTEDCOLUMNS, I just used ... because I didn't know your columns and am lazy. So, something like:
Current Value = CALCULATE(MAX(Table[Value]), LASTDATE((SELECTCOLUMNS(FILTER(Table, Table[Date] <= NOW()),"Date",[Date])))
@Greg_Deckler Hello - Please forgive me if I'm not using correct forum etiquette by replying to a closed thread, but this is the closest answer I've found.
I'm getting error "Function 'LASTDATE' cannot be used with columns added by ADDCOLUMNS or SUMMARIZE functions". This is the measure I'm using
Current Balance =
CALCULATE(
SUM('Deposits'[CurrentBalance])
,LASTDATE(
SELECTCOLUMNS(
FILTER('Date','Date'[Calendar Date]<NOW())
,"Date",'Date'[Calendar Date]
)
)
)
My date table has future dates in it and it sounded like this was the closest solution, but I can't figure out what I'm doing wrong. Any assistance would be greatly appreciated!
Try:
Current Balance =
VAR __LastDate =
MAXX(
FILTER('Date', [Calendar Date]<NOW()),
[Calendar Date]
)
VAR __Result = SUMX(FILTER('Deposits', [Date] = __LastDate), [CurrentBalance])
RETURN
__Result
@Greg_Deckler
I am trying to do the same on my PBI.
here are my column names and I need to find the last status update. I created a new column that combines the last event day and time.
Customer Confirmation Number | Delivery Confirmation Number | Manifest Date | Receive Date | Last Event Date | Last Event Time | Last Event Description | Zip or Postal Code |
Please let me know how I should go about getting this most recent status.
I tried to use the following but its not pulling back the latest status:
That worked!! Thanks so much 🙂
User | Count |
---|---|
107 | |
87 | |
81 | |
76 | |
71 |
User | Count |
---|---|
112 | |
105 | |
96 | |
74 | |
66 |