Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

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 IDLoad_dateRouteCitySEQ NUMTruck_AssignedCurrent Date Flag
1234July 30,2020USABOHLock1XJuly 30,2020 1
4567July 21,2020USFRESFRE1XJuly 30,2020 0
7890July 30,2020USGA01WES1XJuly 30,2020 1
987July 30,2020USGA01VAL2 July 30,2020 1
6543July 30,2020USMA01OLI BR1 July 30,2020 0
3456July 30,2020USMA01OLI BR1 July 30,2020 0
7888July 30,2020USMA01OLI BR1XJuly 30,2020 1
2134July 30,2020USMA01OLI BR1XJuly 30,2020 1
5490July 30,2020USTN01LAV2 July 30,2020 1
5103July 30,2020USTN01LAV2 July 30,2020 0
4309July 30,2020USTN01LAKE1 July 30,2020 1
7 REPLIES 7
v-easonf-msft
Community Support
Community 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

parry2k
Super User
Super 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.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not 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.

6543July 30,2020USMA01OLI BR1 July 30,2020
3456July 30,2020USMA01OLI BR1 July 30,2020
7888July 30,2020USMA01OLI BR1XJuly 30,2020
2134July 30,2020USMA01OLI BR1XJuly 30,2020


One more logic, on below record. There no truck assigned. But For each combination I need consider one row as orginal record.

5490July 30,2020USTN01LAV2 July 30,2020
5103July 30,2020USTN01LAV2 July 30,2020
4309July 30,2020USTN01LAKE1 July 30,2020

Hi, @Anonymous 

I'm a little confused about these two sets :

6543	July 30,2020	USMA01	OLI BR	1	 	July 30,2020	 	0
3456	July 30,2020	USMA01	OLI BR	1	 	July 30,2020	 	0
5490	July 30,2020	USTN01	LAV	2	 	July 30,2020	 	1
5103	July 30,2020	USTN01	LAV	2	 	July 30,2020	 	0

Why the result of the first set is 0 and 0, and the result of  the second set is 1 and 0?
Can you share more details?

 

Best Regards,
Community Support Team _ Eason

@Anonymous not sure I followed it completely, what you mean column name will not be the same?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

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"
)

 

In Column1 ="ABC" & Column2"XYZ" & Column3=123 , You want me to give Route & City & SEQ number value right ? .. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors