Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am having trouble with interpreting an audit trail. The ultimate goal is to have a time slicer that allows the report user to see what the data looked like at any point in the past. Because I'm struggling, I'm taking a staged approach:
The real table has dozens of columns, but I hope that the information here will be adequate. I started with creating a new table with a summarize command. Then I improved the code a bit to be more accurate and flexible, and used CalculateTable:
2022Q2 =
VAR _filter = Filter(View, TRUE())
//VAR _filter = Filter(View, value(View[Date]) < Value(DATE(2022,07,01)))
RETURN
CalculateTable(View,
_filter,
filter(View,
View[Version] = MaxX(
Filter(_filter, (View[Key] = Earlier(View[Key]))),
View[Version]
)
)
)
Because the date is in the future, I can interchange the commented code with the VAR line and get the same, expected, result.
When I change the date to something in the past, I am dropping records incorrectly.
2021Q4 =
VAR _filter = filter(View, value(View[Date]) < Value(DATE(2022,01,01)))
RETURN
CalculateTable(View,
_filter,
filter(View,
View[Version] = MaxX(
filter(_filter, (View[Key] = earlier(View[Key]))),
View[Version]
)
)
)
The expected number should be over 1000 records. This count of 75 shows the records that were not updated this year - the records which have a max version before the filter date.
I would appreciate assistance in fixing the formula for creating tables at a fixed point in time.
Solved! Go to Solution.
I just solved my own problem while writing the question.
My original code was copied with the corrected filter before I saw that the result was right:
2021Q4 =
VAR _filter = filter(View, value(View[Date]) < Value(DATE(2022,01,01)))
RETURN
CalculateTable(View,
_filter,
filter(View,
View[Version] = MaxX(
filter(View, (View[Key] = earlier(View[Key]))),
View[Version]
)
)
)
This was the code used to get the wrong result - notice the filter in MAXX
(apologies if anybody was looking at this in the time it took me to see that it was solved!)
I just solved my own problem while writing the question.
My original code was copied with the corrected filter before I saw that the result was right:
2021Q4 =
VAR _filter = filter(View, value(View[Date]) < Value(DATE(2022,01,01)))
RETURN
CalculateTable(View,
_filter,
filter(View,
View[Version] = MaxX(
filter(View, (View[Key] = earlier(View[Key]))),
View[Version]
)
)
)
This was the code used to get the wrong result - notice the filter in MAXX
(apologies if anybody was looking at this in the time it took me to see that it was solved!)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
63 | |
55 | |
53 | |
36 | |
34 |
User | Count |
---|---|
85 | |
74 | |
55 | |
45 | |
43 |