Forum Discussion
Help creating a column that determines whether or not a row is displayed after counter reset
- Anonymous1 year ago
Thanks for the reply from lbendlin.
Hi PomJack,
As lbendlin said, we can create a measure and here are the steps to do so:
1. Create a measure:
Display = VAR _date=CALCULATE(MAX('Table'[Time Stamp]),FILTER(ALL('Table'),'Table'[Error Count]=1)) RETURN IF(MAX('Table'[Time Stamp])>=_date,"y","n")2. Filter the data with the measure value of y:
3. Result:
Best Regards,
ZhuIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
So you want all the rows after the latest date that has an Error Count of 1 (including that row) ?
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZZDJDcQgDAB74R0J34ZaUPpvYzkdaflY4BnLR2uJQD09CXPJBKT9qTISkt6nJS8L+ge5R56QlSe0gDQStCH+w5mYULXarMWMU5DxodGrbKE4bEE+YdT4EaTcAvVoIdgtjBk0BLwFiN2VrZ4Z4AgVY31lEVrcDzaIAyhDlYVjRdV1gvcH", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Die Hits" = _t, #"Time Stamp" = _t, Index = _t, #"Error Count" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Time Stamp", type date}, {"Error Count", Int64.Type}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Time Stamp] >= List.Max(Table.SelectRows(#"Changed Type", each [Error Count]=1)[Time Stamp]))
in
#"Filtered Rows"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the entire Source step with your own source.
- PomJack1 year agoFrequent Visitor
Yes, that is one way of framing the problem.
- lbendlin1 year ago
Super User
I added the sample code.
- PomJack1 year agoFrequent Visitor
The table in this question is already in table view in Power BI. The Error Count column is a new calculated column in the table view. Is there a way to do the same thing as above, but in table view instead of power query? I should have included these details in the original post.