I am trying to group the minimum arrivedOn datetime by both day and technician using Power BI. Here is an example of my table:
I am tasked with finding when a technician arrived on their first job grouped by each day. It seems to me that I would need to first group the minimum arrivedOn datetime by each Technician. And then group that measure by each day. However, everytime I try this it refuses to work.
Here is what I am trying to achieve:
Any help especially some correct Dax formulas would be very much appreciated.
Thanks!
Solved! Go to Solution.
Hi @mmcarthur ,
Create a new table like below:
Table 2 =
var tmp1 = ADDCOLUMNS('Table',"date",DATEVALUE('Table'[scheduled start]))
var tmp2 = SUMMARIZE(tmp1,[date],'Table'[technician],"job number",MIN('Table'[job number]),"arrived on",MIN('Table'[arrived on]),"scheduled start",MIN('Table'[scheduled start]))
var tmp3 = ADDCOLUMNS(tmp2,"arrived - schedualed",DATEDIFF([scheduled start],[arrived on],MINUTE))
var tmp4 = ADDCOLUMNS(tmp3,"islate",IF([arrived - schedualed]>0,1,0))
return
tmp4
Hi @mmcarthur ,
Create a new table like below:
Table 2 =
var tmp1 = ADDCOLUMNS('Table',"date",DATEVALUE('Table'[scheduled start]))
var tmp2 = SUMMARIZE(tmp1,[date],'Table'[technician],"job number",MIN('Table'[job number]),"arrived on",MIN('Table'[arrived on]),"scheduled start",MIN('Table'[scheduled start]))
var tmp3 = ADDCOLUMNS(tmp2,"arrived - schedualed",DATEDIFF([scheduled start],[arrived on],MINUTE))
var tmp4 = ADDCOLUMNS(tmp3,"islate",IF([arrived - schedualed]>0,1,0))
return
tmp4
The measure I am trying to get for this is the number first jobs for each day worked for all technicians that were late divided by the total number of first jobs for each day worked for all technicians.
@mmcarthur Can you just put Date, Technician in a Table visual and use MIN('Table'[Arrived On]) ?
That is not gonna work for what I'm needing. I'm needing to create measures based on the grouping so I would need to know how to make sure DAX is taking the minimum arrived on time for each day for each technician.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!