Forum Discussion

MiklosSz's avatar
MiklosSz
Frequent Visitor
1 year ago
Solved

Filter data table based on today

Hello community,   I'd like to ask for help since I just started using PowerBI.   I need to filter my data table for charts - or mark specific rows. The filter should be for ongoing works and wor...
  • MiklosSz's avatar
    1 year ago

    Dear DataNinja777 and Ashish_Mathur,

     

    Based on your input and and examples I managed to study the problem and the logic of DAX for which I am tremendously grateful.

     

    Here is how I solved the problem, and seems to be okay, but requires further testing and possible adjustments:

     

    When = switch(True(),
    [StartDate]=today(),"Today",
    [Startdate]>today() && [Startdate]<today()+14,"Soon",
    [Startdate]<today() && [DueDate]<today(),"Past",
    today()>[StartDate] && today()<=[DueDate], "Present",
    [Startdate]>=today()+14,"Future")

     

    This basically divides the past works, ongoing works, expected start of works "soon", and future works plus I added today's starting works as an added coloum to my data table.