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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
hjoshi4u26
Regular Visitor

Power Query Group Data where value is >= 0

Hello All,

 

I have a Table show below

hjoshi4u26_0-1678964377592.png

Ask is to Group the data by [Month] and Count Rows where [Value] >= 0. I have used below M-code but it is faulty.

= Table.Group(#"Changed Type", {"Month"}, {"Count", each Table.RowCount(Table.SelectRows(#"Changed Type", each [Value] >= 0))})

 

hjoshi4u26_1-1678964881710.png

 

Can anybody please help me here and explain to me where I am wrong along with solution. It would be of much help. Thanks 🙂

1 ACCEPTED SOLUTION
andhiii079845
Super User
Super User

You do no "group by". My solution:

andhiii079845_3-1678971326687.png

 

1) Filter first the column  

andhiii079845_0-1678971263144.png

2) Group by

andhiii079845_4-1678971418218.png

 

 

The result:

andhiii079845_2-1678971313888.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
andhiii079845
Super User
Super User

You do no "group by". My solution:

andhiii079845_3-1678971326687.png

 

1) Filter first the column  

andhiii079845_0-1678971263144.png

2) Group by

andhiii079845_4-1678971418218.png

 

 

The result:

andhiii079845_2-1678971313888.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I cannot filter the data >=0 as there are other columns also which are being used for different calculations.

Than you have to make a full data example please! 🙂

And your desired result. 

For the "group by" you have to think about what should happend to the second column.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




No worries. I did a workaround as you suggested. I created separate table, Disabled Load in Report, and appended the table based on Date. Solved the problem

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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