Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Select only Distinct Rows but get the earliest date from them

Hi All,

 

I'm attempting something with Power BI not sure if it's easy enough to do - but I have a CSV with multiple rows of data that is generated each week from our Ticket system(s) - so I need to run reports on the data that's generated weekly and then be able to break it down by month - thats the easy part - I have the CSV's being combined but the fun part is the following:

 

I need to get the Oldest ticket from the database, it's setup as such:

 

NumberOpen_datestateContactTitleclientadditional_rowadditional_row_1additional_row_2additional_row_3
JB-123401/03/2023OpenPhoneAccess to SystemBobs Burgersxxxx
JB-123404/03/2023PendingPhoneAccess to SystemBobs Burgersxxxx
JB-123409/03/2023PendingPhoneAccess to SystemBobs Burgersxxxx

 

Etc. - I have it filtering the data out for anything that's not an Open Status with

 

 

 

 

MS OldestTicket = CALCULATE(min(Database[Open_Date]),FILTER(Database, NOT Database[state] IN {"Closed Complete", "Cancelled", "Closed", "Closed Cancelled", "Canceled", "Closed Incomplete", "Closed Skipped", "Resolved"}))

 

 

 

I tried:

 

 

 

MS OldestTicket = CALCULATE(min(Database[Open_Date]),FILTER(Database, NOT Database[state] IN {"Closed Complete", "Cancelled", "Closed", "Closed Cancelled", "Canceled", "Closed Incomplete", "Closed Skipped", "Resolved"}))

 

 

 

with other variations using DISTINCT( etc. but not sure how to do it, essentially I need to ignore it if it's been closed at a later date and just grab the earliest.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    //with other variations using DISTINCT

    Could you please explain what your expected output is? The result now looks like this.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum