Forum Discussion

cborde3's avatar
cborde3
Frequent Visitor
3 years ago
Solved

Days Since Event

Hello,

 

I'm trying to create a column chart for Days Since Event, filtered by states.  I have four states to filter through.  I know I need to use the DateDiff function, but I'm having a problem filtering by a particular state.  Any advice?

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi cborde3 ,

    I created a sample pbix file(see the attachment), please check if that is what you want.

    Measure = DATEDIFF(MIN('Table'[Incident Date]),TODAY(),DAY)

    If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format, your column chart field settings and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi cborde3 ,

    I created a sample pbix file(see the attachment), please check if that is what you want.

    Measure = DATEDIFF(MIN('Table'[Incident Date]),TODAY(),DAY)

    If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format, your column chart field settings and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards

  • cborde3 , Not very clear, But earlier can help

    Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8

     

    You can get the last date and take diff

     

    new column =

    var _max = maxx(filter(table, [Pcrs reference] = earlier([Pcrs reference])  && [Date]< earlier([Date]) ), [Date])

    return

    datediff(_max, [Date], day)