Forum Discussion

NewbieJono's avatar
NewbieJono
Post Partisan
5 years ago
Solved

Filter - Previous working day

i have this code to identify "today". is there a method i could use to also identify previous working day, ihave a coloumn that indicates if its a working day or not and returns 1,0   WorkingDay = ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi NewbieJono 

     

    So you are doing 2 Calculated columns? your "today" is not actually today, but working day...you want something like this?

     

    test = 
    var workingDays = filter('Date', 'Date'[Date] <=today() && [WorkingDay] =1)
    var today = MAXX(workingDays,[Date])
    var previous = MAXX(FILTER(workingDays,[Date]<today),[Date])
    return
    SWITCH(TRUE(),
    [Date]=today,"Today",
    [Date] = previous, "Previous Working Day",
    Format([Date], "DD/MM/YYYY"))