Forum Discussion
Condition based duplicate value set Flag
Hi Team,
I have below data, I want set "Flag" based on come columns condition.
For Flag one.
- If "Current Date" and "Load_date" same or not, If same date Group by "Route" & "City" & "SEQ NUM" and check "Truck_Assigned" X . If "Truck_Assigned" X then Flag is 1.
- If "Current Date" and "Load_date" same or not, If same date Group by "Route" & "City" & "SEQ NUM" and check "Truck_Assigned" X not assigned but unique value then Flag is 1.
-If "Current Date" and "Load_date" same or not, If same date Group by "Route" & "City" & "SEQ NUM" and check "Truck_Assigned" X not assigned but two value then set any one of row as Flag is 1.
| Route ID | Load_date | Route | City | SEQ NUM | Truck_Assigned | Current Date | Flag | |
| 1234 | July 30,2020 | USABOH | Lock | 1 | X | July 30,2020 | 1 | |
| 4567 | July 21,2020 | USFRES | FRE | 1 | X | July 30,2020 | 0 | |
| 7890 | July 30,2020 | USGA01 | WES | 1 | X | July 30,2020 | 1 | |
| 987 | July 30,2020 | USGA01 | VAL | 2 | July 30,2020 | 1 | ||
| 6543 | July 30,2020 | USMA01 | OLI BR | 1 | July 30,2020 | 0 | ||
| 3456 | July 30,2020 | USMA01 | OLI BR | 1 | July 30,2020 | 0 | ||
| 7888 | July 30,2020 | USMA01 | OLI BR | 1 | X | July 30,2020 | 1 | |
| 2134 | July 30,2020 | USMA01 | OLI BR | 1 | X | July 30,2020 | 1 | |
| 5490 | July 30,2020 | USTN01 | LAV | 2 | July 30,2020 | 1 | ||
| 5103 | July 30,2020 | USTN01 | LAV | 2 | July 30,2020 | 0 | ||
| 4309 | July 30,2020 | USTN01 | LAKE | 1 | July 30,2020 | 1 |
7 Replies
- parry2kSuper User
Anonymous you can use switch functon like this
SWITCH ( TRUE(), Table[Column1] = "ABC" && Table[Column2] = "XYZ" && Table[Column3] = 123, "Value 1", Table[Column1] = "ABC" || ( Table[Column2] = "XYZ" && Table[Column3] = 123 ), "Value 2", Table[Column1] = "ABC" || Table[Column2] = "XYZ" || Table[Column3] = 123, "Value3", "Catch all" )I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- parry2kSuper User
Anonymous to add more
&& -> Is used for and condition
|| -> is used for or condition
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- AnonymousNot applicable
Hi,
Thanks for reply.
I Column value won't same always . We can't use switch condition.
Logic is , On below record. I want display only lost two row data. Because It's assigned "X" and Don't want display which is no assigned X.
6543 July 30,2020 USMA01 OLI BR 1 July 30,2020 3456 July 30,2020 USMA01 OLI BR 1 July 30,2020 7888 July 30,2020 USMA01 OLI BR 1 X July 30,2020 2134 July 30,2020 USMA01 OLI BR 1 X July 30,2020
One more logic, on below record. There no truck assigned. But For each combination I need consider one row as orginal record.5490 July 30,2020 USTN01 LAV 2 July 30,2020 5103 July 30,2020 USTN01 LAV 2 July 30,2020 4309 July 30,2020 USTN01 LAKE 1 July 30,2020
- v-easonf-msftCommunity Support
Hi , Anonymous
Could you please tell me whether your problem has been solved?
If yes, you could accept the helpful answer as solution. You also could share your own solution here. For now, there is no content of description in the thread. If you still need help, please share more details to us.Best Regards,
Community Support Team _ Eason