Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello All, appreciate your help in this.
I am trying to filter my table, by getting one company value for each date, there are some cases where one employee worked for two companies during the same day and I need to filter the data for the one that has a higher time duration.
Conditions For the filter
Current Table
| Reported Date | Employee | Employee ID | Total Duration | Company | |
| 12/1/2022 | Andy | 123 | 8 | Cars Company | |
| 12/1/2022 | Andy | 123 | 7 | Mobile Company | |
| 12/1/2022 | Sam | 321 | 8 | Chicken Company | |
| 12/1/2022 | Sam | 321 | 8 |
| |
| 12/3/2022 | Dan | 456 | 5 | Soups Company | |
| 2/2/2023 | Sam | 123 | 8 | Soups Company |
Expected filtered Table
| Reported Date | Employee | Employee ID | Total Duration | Company |
| 12/1/2022 | Andy | 123 | 8 | Cars Company |
| 12/1/2022 | SAm | 321 | 8 | Chicken Company |
| 12/3/2022 | Dan | 456 | 5 | Soups Company |
| 2/2/2023 | Sam | 123 | 8 | Soups Company |
The goal is to get unique company values for each date employee id on each date available.
Solved! Go to Solution.
Hi,
you have to group by
Expand all rows
add 2 conditional columns
and finally filter all Yes
(you obtain the company in alphabetical order, if you want the first you have to add an index before)
You can take a look at the attached file
If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!
Hi,
you have to group by
Expand all rows
add 2 conditional columns
and finally filter all Yes
(you obtain the company in alphabetical order, if you want the first you have to add an index before)
You can take a look at the attached file
If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!
Its removing some of my dates, I need to keep all the dates but it seems when it encounters the same duration for the same date and with a different company it removes the date completely. Please Help. Wondering if this is related to not adding the index, could you explain that step by step, thanks in advance.
Current Status
| Employee Id | Company | Date | Duration |
| 123 | Chicken Company | 1/1/2023 | 4 |
| 123 | Box Company | 1/1/2023 | 4 |
| 321 | Box Company | 1/2/2023 | 8 |
Error out of query:
| Employee Id | Company | Date | Duration |
| 321 | Box Company | 1/2/2023 | 8 |
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 42 | |
| 35 | |
| 35 | |
| 22 | |
| 15 |
| User | Count |
|---|---|
| 65 | |
| 58 | |
| 29 | |
| 27 | |
| 25 |