web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to include value z...
Power Apps
Unanswered

How to include value zero group by collection

(0) ShareShare
ReportReport
Posted on by 327

Hi all

 

how can I add 0 value in the collection for charts?

ClearCollect(
 colAllValues,
 ForAll(
 NWAllocation,
 AllocatedTo.Value
 )
);

ClearCollect(
 colNewUserNo,
 AddColumns(
 colAllValues,
 "SResult",
 If(
 Value = "Sa" ||
 Value = "Be" ||
 Value = "Wi" ||
 Value = "Di" ||
 Value = "Es" ||
 Value = "Je" ||
 Value = "Jo" ||
 Value = "Ji" ||
 Value = "Ju" ||
 Value = "Lo" ||
 Value = "Ma" ||
 Value = "Ni" ||
 Value = "Nm" ||
 Value = "Ru" ||
 Value = "Sa" ||
 Value = "Sh" ||
 Value = "Sl" ||
 Value = "So" ||
 Value = "Sy" ||
 Value = "Th",
 1,
 0
 )
 )
);

ClearCollect(
 colGroupResult,
 DropColumns(
 AddColumns(
 GroupBy(colNewuserNo, "Value", "GroupedValue"),
 "SResult",
 Sum(GroupedValue, SResult)
 ),
 "GroupedValue"
 )
);

moerah_0-1705973450648.png

like to include user with 0 result in chart

 

thank you

 

Categories:
  • BDallas Profile Picture
    74 on at

    @moerah you can add 0 by including Collect(colGroupResult, {Value: "0", SResult: 0})   to your code

     

     

    ClearCollect(
     colAllValues,
     ForAll(
     NWAllocation,
     AllocatedTo.Value
     )
    );
    
    ClearCollect(
     colNewUserNo,
     AddColumns(
     colAllValues,
     "SResult",
     If(
     Value = "Sa" ||
     Value = "Be" ||
     Value = "Wi" ||
     Value = "Di" ||
     Value = "Es" ||
     Value = "Je" ||
     Value = "Jo" ||
     Value = "Ji" ||
     Value = "Ju" ||
     Value = "Lo" ||
     Value = "Ma" ||
     Value = "Ni" ||
     Value = "Nm" ||
     Value = "Ru" ||
     Value = "Sa" ||
     Value = "Sh" ||
     Value = "Sl" ||
     Value = "So" ||
     Value = "Sy" ||
     Value = "Th",
     1,
     0
     )
     )
    );
    
    ClearCollect(
     colGroupResult,
     DropColumns(
     AddColumns(
     GroupBy(colNewuserNo, "Value", "GroupedValue"),
     "SResult",
     Sum(GroupedValue, SResult)
     ),
     "GroupedValue"
     )
    );
    
    Collect(colGroupResult, {Value: "0", SResult: 0})

     

    If this solves your question, please accept it as a solution.

    Thanks!

    Dallas

  • moerah Profile Picture
    327 on at

    Thank you @BDallas for the reply

     

    unfortunately, it's not working  the way I want it's just displaying 0-0

    moerah_0-1705976047205.png

     

  • BDallas Profile Picture
    74 on at

    @moerah  Please try this modified code.

    ClearCollect(
     colAllValues,
     ForAll(
     NWAllocation,
     AllocatedTo.Value
     )
    );
    
    ClearCollect(
     colNewUserNo,
     AddColumns(
     colAllValues,
     "SResult",
     If(
     Value = "Sa" ||
     Value = "Be" ||
     Value = "Wi" ||
     Value = "Di" ||
     Value = "Es" ||
     Value = "Je" ||
     Value = "Jo" ||
     Value = "Ji" ||
     Value = "Ju" ||
     Value = "Lo" ||
     Value = "Ma" ||
     Value = "Ni" ||
     Value = "Nm" ||
     Value = "Ru" ||
     Value = "Sa" ||
     Value = "Sh" ||
     Value = "Sl" ||
     Value = "So" ||
     Value = "Sy" ||
     Value = "Th",
     1,
     0
     )
     )
    );
    
    ClearCollect(
     colGroupResult,
     DropColumns(
     AddColumns(
     GroupBy(colNewuserNo, "Value", "GroupedValue"),
     "SResult",
     Sum(GroupedValue, SResult)
     ),
     "GroupedValue"
     )
    );
    
    ClearCollect(
     colGroupResult,
     AddColumns(
     colGroupResult,
     "Value", "0",
     "SResult", 0
     )
    )

      

    Let me know if this works for you. @ me in replies, or I'll lose your thread!!!  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 283

#3
Mohsin Ali Profile Picture

Mohsin Ali 221

Last 30 days Overall leaderboard