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

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

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