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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
iekiekiek
New Member

Powe Query - How do get the ttl count of the column is >0?

Hi All, i have a table as follow and would like to add a column custom column (TTL Item as follow) in power query that counts all the rows that are >= 1, i have found multiple formulas but they didn't calculate correctly. Can you please help?

 

NameAppleBananaGrapesTTL Item
John1 22
Mary 2 1
David1343
Tom11 2
1 ACCEPTED SOLUTION
Rakesh1705
Super User
Super User

Source Data

Rakesh1705_1-1722936685833.png

Replacing null with 0

Rakesh1705_2-1722936713742.png

Finding the Apple Count

Rakesh1705_3-1722936743293.png

Same way Banana and Grapes Count is found

Rakesh1705_4-1722936790151.png

Total Item=Apple Count+Banana Count+Grapes Count

Rakesh1705_5-1722936826029.png

If this solves your issue then please accept the same as your solution.

View solution in original post

2 REPLIES 2
Rakesh1705
Super User
Super User

Source Data

Rakesh1705_1-1722936685833.png

Replacing null with 0

Rakesh1705_2-1722936713742.png

Finding the Apple Count

Rakesh1705_3-1722936743293.png

Same way Banana and Grapes Count is found

Rakesh1705_4-1722936790151.png

Total Item=Apple Count+Banana Count+Grapes Count

Rakesh1705_5-1722936826029.png

If this solves your issue then please accept the same as your solution.

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your quetion correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1722914012684.png

 

 

let
    Source = Data_source,
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each [Value] >= 1),
    #"Grouped Rows" = Table.Group(#"Filtered Rows", {"Name"}, {{"TTL Item", each Table.RowCount(_), Int64.Type}}),
    #"bring back Source" = Source,
    #"Merged Queries" = Table.NestedJoin(#"bring back Source", {"Name"}, #"Grouped Rows", {"Name"}, "Grouped Rows", JoinKind.LeftOuter),
    #"Expanded Grouped Rows" = Table.ExpandTableColumn(#"Merged Queries", "Grouped Rows", {"TTL Item"}, {"TTL Item"})
in
    #"Expanded Grouped Rows"

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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