Forum Discussion
Filtering rows based on column contents
I am trying to make a report in PowerBI that shows the status of files in a list. The rows in the dataset are being pushed into the table from a connector in Flow. So I want to show a file as Pending only if it hasn't later been Approved or Rejected.
Each file has a uniqie ID. My idea was to filter the Pending row if there is an exact match in the FileID column. In a PowerBI report, how can I only display the row that says Pending when there is not a duplicate number in FileID for Approve or Reject?
In the example below, I only want to show the Approve row for upload-demo.docx, the Reject row for test-send.xlsx, and the Pending row for export.site.txt. Please help!
| FileID | Filename | Status |
| 5MFIYUS2 | upload_demo.docx | Approve |
| 5MFIYUS2 | upload_demo.docx | Pending |
| M3R33DJL | test-send.xlsx | Pending |
| M3R33DJL | test-send.xlsx | Reject |
| CYFH25YP | export-site.txt | Pending |
2 Replies
- Greg_DecklerCommunity Champion
You are going to need a flag column or measure along the lines of:
Flag Column = VAR __Statuses = SELECTCOLUMNS(FILTER('Table',[FileID] = EARLIER([FileID]),[Status]) RETURN SWITCH(TRUE(), [Status] = "Approvied" || [Status] = "Rejected",1, NOT("Approved" IN __Statuses) && NOT("Rejected" IN __Statuses),1, 0 )- annetoalHelper II
Thank you for the code. Since this is a report coming from a streaming dataset, won't I be limited to just the one table 'RealTimeData'? PowerBI won't allow the table Statuses in the report with the table made from the streaming dataset. Apologies for the noob questions.
Anne