Forum Discussion
Tarunika
Helper II
3 years agoGet a value based on the condition from another column
Hi all ,
Below is the sample data i want to take only those ID_meter for which the Field_Service_status is 1 can anyone help me in the dax.
| ID_METER | MASKED_MEP | METER_AGE | DEV_CODE | EVENT1 | EVENT2 | EVENT3 | EVENT4 | EVENT5 | Field_Service_status | |
| 1184074 | 6.39E+09 | 5140 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 0 | ||
| 1185412 | 6.4E+09 | 3821 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 0 | ||
| 2045 | 8765217 | 3815 | PR | 0 | ||||||
| 1185414 | 6.4E+09 | 5165 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 0 | ||
| 1184510 | 6.4E+09 | 3712 | Strömavbrott, start | Strömavbrott, stopp | Strömavbrott, start (Omedelbar leverans) | 0 | ||||
| 1186893 | 6.41E+09 | 4780 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 0 | ||
| 698 | 2908695 | 3957 | PR | Strömavbrott, start | Strömavbrott, start | Strömavbrott, start | Strömavbrott, stopp | Strömavbrott, stopp | 0 | |
| 1183508 | 6.39E+09 | 5257 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 1 | ||
| 1187529 | 6.41E+09 | 5217 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 1 | ||
| 1185521 | 6.4E+09 | 3018 | Information, oformaterat | Information, oformaterat | Fel, oformaterat | Fel, oformaterat | Fel, oformaterat | 0 | ||
| 1188061 | 6.41E+09 | 5223 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 1 | ||
| 1186457 | 6.4E+09 | 5210 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 1 | ||
| 1184810 | 6.4E+09 | 5112 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 1 | ||
| 1185813 | 6.4E+09 | 5300 | Överspänning | Överspänning, stopp | Överspänning | Överspänning, stopp | Överspänning | 1 | ||
| 1183909 | 6.39E+09 | 5264 | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 1 | ||
| 1187871 | 6.41E+09 | 5196 | NS | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | Klockan gick ej att ställa | 1 |
Thanks
Hi Tarunika ,
You could use the below dax to create a new table to get filtered table:
Table2 = CALCULATETABLE('Table','Table'[Field_Service_status]=1)Best Regards
Lucien
2 Replies
- v-luwang-msft
Community Support
Hi Tarunika ,
You could use the below dax to create a new table to get filtered table:
Table2 = CALCULATETABLE('Table','Table'[Field_Service_status]=1)Best Regards
Lucien
- lbendlin
Super User
You don't need DAX for that. Add a visual level, page level, or report level filter to your filter pane based on that columns. Or filter already in Power Query.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("1ZVdSsNAEMevsuRJMcjOfu8BFERQsY+lD1uNpTZNSrr0WegRvIJn8AD2Jp7EzSaNTWilFcHuw7KbHSaZ33z80+9HAIphyaI4EudUX5xh7Y4cGHYbcus6zR8mJkOj8cMEJc/IWIvmdrX8eEtTcwR2HA1iT8EZEE/BagiqCAQFQTDj7kFJwQlITwDlxd19jdFdm+ysxc5B8KDYyzbkgNsFlL6iJUTPFs7jfWoWwyK3NnZvMIXdbshns50e6OR2mjwm6dAUKE0WSWGy+akPovrOOhahNK1igToYJlVYIyG0cmeisRK67AWquVw30yHpPNywswCVoSk45Vh1dIf4GENIMqwpJCe63Sr19AZFwbkXy43hw6BqiKvsKS+mxo7zLEZ5dXaTY382XSbp766a/lBYQDezhIaWWcF8T29oM4FQlKSBYKqjzRwabf7vIPfvcQW0DUHxuhKr5efLq/sfzGelY5aNs9H2228d+zOXJkCqse4KomChpVkq2R1b0MJtN70jCHMPjMEX", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID_METER = _t, MASKED_MEP = _t, METER_AGE = _t, DEV_CODE = _t, EVENT1 = _t, EVENT2 = _t, EVENT3 = _t, EVENT4 = _t, EVENT5 = _t, Field_Service_status = _t]), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"ID_METER", "MASKED_MEP", "METER_AGE", "DEV_CODE", "Field_Service_status"}, "Attribute", "Value"), #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Field_Service_status] = "1")) in #"Filtered Rows"What you will want to do is unpivot all the Event columns.