Forum Discussion
Dynamically filter last row per item
- 3 years ago
You could try
Sum of last rows = VAR ChosenDate = MAX ( 'Date'[Date] ) VAR SummaryTable = CALCULATETABLE ( INDEX ( 1, 'Fact booking', ORDERBY ( 'Fact booking'[Last modified date], DESC ), PARTITIONBY ( 'Fact booking'[Sales ID] ) ), 'Date'[Date] <= ChosenDate ) VAR Result = SUMX ( SummaryTable, 'Fact booking'[Sales value] ) RETURN ResultThis makes a few assumptions. Firstly that your date table is linked to your fact table on the last modified date. Secondly, you will need a unique identifier for each row in fact booking. If you don't have one naturally you can add an index column using power query. Make sure that the unique column is marked as the key column in the modelling view, that will stop INDEX complaining that the table may have duplicates.
Hi, I am trying to produce something similar but this is not working for me at all . I am told index is not a function?
I have an updates table that update a user status from approved, not approved in categories one and category 2. I also have a calendar table
e.g.
| User name | Category 1 | Category 2 | Created on |
| user 2 | approved | not approved | 5/1/23 |
| user 1 | approved | not approved | 3/1/23 |
| user 2 | approved | approved | 2/1/23 |
| user 1 | not approved | Approved | 1/1/23 |
| user 3 | not approved | approved | 2/1/23 |
I would like to be able to display a bar chart with a date slider that can show for example the countof category one approved users on a chosen day...so if I filter to 4/1/23 then the count for category 1 approved user would be 2 (users 1and 2) and the count for category 1 not approved would be 1 (user3), count category 2 approved 2 (users 2 and 3), category 2 not approved 1 (user1) as it would only take into account the latest record for a user not the ones previously. So data table filtered to 4/1/23 as below
| UserName | Category 1 | category 2 | latest Created on |
| user 2 | approved | approved | 2/1/23 |
| user 1 | approved | not approved | 3/1/23 |
| user 3 | not approved | approved | 2/1/23 |
and bar chart as
So far I have this measure w
thanks for your help 🙂