Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
My report has a date/time field that shows the date/time of the first part confirmed for a shift.
I need to display a date/time in a Card that is the earliest time from the most recent date.
My data pulls from a dataflow several times a day and I'm trying to show the most recent data. However for this card I'm trying to show, essentially, at what time did we start making parts for a particular shift.
What I'm currently doing is: I have two card per shift - Earliest confirmation and latest confirmation (each that are flagged in another column as a "first piece confirmation"). I have the field set for the earliest one to show the earliest and the latest to show the latest.
My data for this page is filtered for the relative 2 days, including today.
The issue with this approach is: that the earlierst may show yesterday and the latest may show today (if data exists for today).
What I want is: If there is data for today to show the earliest and latest for it. If not, then show the earliest and latest for yesterday.
[FYI I am inable to share my report or data due to company policy.]
Edit: My data might take one of two forms:
Solved! Go to Solution.
Hi @Saw25 ,
You want two card visuals, one that shows today's latest time and one that shows today's earliest time. If there is no Today in the table, yesterday's is displayed.
Here're two measure for your reference. You can replace DATE(2023,7,12) with TODAY()
the latest time for recent date = var _today=DATE(2023,7,12)
var _date=MAX('Have data tody'[Date])
var _todaymax=MAXX(FILTER(ALLSELECTED('Have data tody'),[Date]=_today),[Date/Time])
var _yesterdaymax=MAXX(FILTER(ALLSELECTED('Have data tody'),[Date]=_today-1),[Date/Time])
var _if=IF(COUNTROWS(FILTER(ALLSELECTED('Have data tody'),[Date]=_today))>=1,_todaymax)
return _if
the earliest time for recent date = var _today=DATE(2023,7,12)
var _date=MAX('Have data tody'[Date])
var _todaymin=MINX(FILTER(ALLSELECTED('Have data tody'),[Date]=_today),[Date/Time])
var _yesterdaymin=MINX(FILTER(ALLSELECTED('Have data tody'),[Date]=_today-1),[Date/Time])
var _if=IF(COUNTROWS(FILTER(ALLSELECTED('Have data tody'),[Date]=_today))>=1,_todaymin,_yesterdaymin)
return _if
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you. I managed to come to almost the same solution. My code is a bit different but it seems to work well. Thank you.
Hi @Saw25 ,
You want two card visuals, one that shows today's latest time and one that shows today's earliest time. If there is no Today in the table, yesterday's is displayed.
Here're two measure for your reference. You can replace DATE(2023,7,12) with TODAY()
the latest time for recent date = var _today=DATE(2023,7,12)
var _date=MAX('Have data tody'[Date])
var _todaymax=MAXX(FILTER(ALLSELECTED('Have data tody'),[Date]=_today),[Date/Time])
var _yesterdaymax=MAXX(FILTER(ALLSELECTED('Have data tody'),[Date]=_today-1),[Date/Time])
var _if=IF(COUNTROWS(FILTER(ALLSELECTED('Have data tody'),[Date]=_today))>=1,_todaymax)
return _if
the earliest time for recent date = var _today=DATE(2023,7,12)
var _date=MAX('Have data tody'[Date])
var _todaymin=MINX(FILTER(ALLSELECTED('Have data tody'),[Date]=_today),[Date/Time])
var _yesterdaymin=MINX(FILTER(ALLSELECTED('Have data tody'),[Date]=_today-1),[Date/Time])
var _if=IF(COUNTROWS(FILTER(ALLSELECTED('Have data tody'),[Date]=_today))>=1,_todaymin,_yesterdaymin)
return _if
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you. I managed to come to almost the same solution. My code is a bit different but it seems to work well. Thank you.
Pode enviar uma amostra dos seus dados com informações ficticias, e exemplo do que deseja?
I updated my post to include a sample.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
88 | |
83 | |
64 | |
49 |
User | Count |
---|---|
127 | |
108 | |
87 | |
70 | |
66 |