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 / CountRows datatable ba...
Power Apps
Suggested Answer

CountRows datatable based on column value - bound to Sharepoint list / choice column

(1) ShareShare
ReportReport
Posted on by 910
Need to count rows in datatable where Rank is a specific value. This is a SharePoint list and Rank is a choice column in SharePoint  -- can't get right syntax 
 
dtresponses is the datatable  'xxxDashboard Responses' is the SharePoint List 
 
Categories:
I have the same question (0)
  • Suggested answer
    MS.Ragavendar Profile Picture
    7,222 Super User 2026 Season 1 on at
     
    I am sharing the approach considering the delegation limit.
     
    Instead of Rank Column -> I created one combo box with values of Offline and Online.
     
    If user selected the value in the combo box and press the button i am calling power automate flow and passing the value of the selection (such as what he has selected i.e. offline or online)
     
    Button On Select - 
     
    Set(vardata,
    getcount.Run(ComboBox1_1.Selected.Value).count)
     
     
     
    Power Automate Flow (getcount)
     
     
    Compose -  length(outputs('Get_items')?['body/value'])
     
    Total Item Count
     
     
    Backend data
     
     
    Based on this you can extend this for your logic as well it will works.
     
    ✅If this helped, please Accept as Solution to help others ❤️ A Like is appreciated 🏷️ Tag @MS.Ragavendar for follow-ups.
  • Suggested answer
    Valantis Profile Picture
    5,971 on at
     
    For a SharePoint choice column, the value is a record with a Value property, not a plain text string. So you need to compare against the .Value property:
    CountRows(Filter(dtresponses, Rank.Value = "YourChoiceValue"))

    Replace YourChoiceValue with the exact choice label text as it appears in SharePoint (case sensitive).

    If you're filtering directly against the SharePoint list instead of the datatable:
    CountRows(Filter('xxxDashboard Responses', Rank.Value = "YourChoiceValue"))
     
    Note this is not delegable to SharePoint for choice columns so if your list has more than 500 rows it will only count from the first 500 records. For accurate counts on large lists, use a CountRows with a ClearCollect to load all records first.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

  • ctedesco3307 Profile Picture
    910 on at
    @Valantis  Thanks for this -- I'm using the datatable ... it does not like Value though ... 
     
  • Suggested answer
    Kalathiya Profile Picture
    2,316 Super User 2026 Season 1 on at
     
    Please try below code:
    With({ 
            _data:'dtresponses'
    },
        CountRows(Filter(_data, Rank.Value = "Good"))
    )
    
    //dtresponses - Replace with you list name if it's wrong
    //Rank - Replace with your column name from SharePoint list if it's wrong
    With({ 
            _data:'xxxDashboard Responses'
    },
        CountRows(Filter(_data, Rank.Value = "Good"))
    )
    
    //xxxDashboard Responses - Replace with you SharePoint list name
    //Rank - Replace with your column name from SharePoint list if it's wrong
    ---------------------------------------------------------------------------
    Glad it helped 🙂
    If this fixed your issue,
    please click “Does this answer your question?” to mark it as verified so others can find the solution easily.
    A Like 👍 is always appreciated, and I’m around if you need more help @Kalathiya
  • Suggested answer
    Valantis Profile Picture
    5,971 on at
     
    That error confirms the datatable is flattening the choice column to plain text. When a SharePoint choice column goes through a datatable, it loses the record structure and becomes a simple text value.

    So the correct syntax is without .Value:
    CountRows(Filter(dtresponses, Rank_Column1 = "YourChoiceLabel"))
    Replace YourChoiceLabel with the exact text that appears in the datatable cell for that choice.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

  • ctedesco3307 Profile Picture
    910 on at
    @Valantis  This works but it's not what I want 
     
    With({ 
            _data:'xxxDashboard Responses'
    },
        CountRows(Filter(_data, Rank.Value = "Good"))
    ) 
     
    The user can filter the data table on three combo boxes and I want the count rows to be based on that filter result in the datatable
     
    I can't get Value to work with Rank - it's not an option I have "Text" not Value 
     
     
     
  • Kalathiya Profile Picture
    2,316 Super User 2026 Season 1 on at
     
    Simple Approach:
    With({ 
            _data:'xxxDashboard Responses' //Copy your Gallery items property code and Replace with "xxxDashboard Responses".
    },
        CountRows(_data)
    ) 
    
    Once you replace it will show count based on filter that you have applied. Or could you please share your Gallery Items Property code we will guide you..
     
    If this helped resolve your issue, please click “Does this answer your question?” so the solution is marked and easier for others to find.
  • ctedesco3307 Profile Picture
    910 on at
    Just to re-confirm - this is a data table - not a Gallery 
     
     
     
     
  • Kalathiya Profile Picture
    2,316 Super User 2026 Season 1 on at
     
    Thanks, Then please copy the data table items property code and past into above formula. As I'm assuming you have already implemented the filter code in Data table. 
    With({ 
            _data:'xxxDashboard Responses' //Copy your Gallery items property code and Replace with "xxxDashboard Responses".
    },
        CountRows(_data)
    ) 
     
  • ctedesco3307 Profile Picture
    910 on at
    @Kalathiya  its a datatable not a gallery - I tried this already and does not work - see above -- thank you!!!
     
     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 414

#2
Valantis Profile Picture

Valantis 408

#3
timl Profile Picture

timl 339 Super User 2026 Season 1

Last 30 days Overall leaderboard