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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Group by with filters power query

Hi, I want to create in Power query the next table

eduardosilvin1_1-1633710056825.png

 

 

1) I need to group by the ones that have the same date and hour

2) in each group make an "IF" selecting just the ones that have "Yes" in the "Correct" column, for those that have several rows in the group and at least one "Yes", select the one with the lower value in "Cost"

3) for those that have just one row and the value is "No" or several rows and all of them are "No", select the one with the lower value in "Cost". 

4) The result table will be 1 row per group, keeping all the others columns on it.

 

Thank you so much in advance

Regards

1 ACCEPTED SOLUTION

Hi See attached the power bi file

 you need to do multiple group by's to get the desired result.  

vanessafvg_0-1633766247573.png

 

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
vanessafvg
Super User
Super User

please provide your data in text format.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

Sure @vanessafvg 

 

 

 

 

 

Original table					
					
Es Date	                    Cost Correct	x	y	z
05/10/2021 07:05:43 p. m.	10	No	Example	Example	Example
05/10/2021 07:13:06 p. m.	5	No	Example	Example	Example
05/10/2021 07:13:06 p. m.	4	No	Example	Example	Example
06/10/2021 05:17:13 p. m.	6	Yes	Example	Example	Example
06/10/2021 05:17:13 p. m.	5	Yes	Example	Example	Example
06/10/2021 05:17:13 p. m.	2	Yes	Example	Example	Example
06/10/2021 05:17:13 p. m.	1	No	Example	Example	Example
					
					
Result table					
					
Es Date	                    Cost  Correct	x	y	z
05/10/2021 07:05:43 p. m.	10	No	Example	Example	Example
05/10/2021 07:13:06 p. m.	4	No	Example	Example	Example
06/10/2021 05:17:13 p. m.	2	Yes	Example	Example	Example

 

 

 

 

Hi See attached the power bi file

 you need to do multiple group by's to get the desired result.  

vanessafvg_0-1633766247573.png

 

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.