cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TurboTape
Resolver I
Resolver I

Doing countrows inside ForAll allways 1

Hello good people of Power Community.

 

It's getting late, and I have used way to much time allready, so hope someone can help me out. 


Im looking for a clever way to count the number of reports and display it as a piechart

I have a category list with 4 categories (but it can be as many as the user like)

I have a report list with HSEQ reports that has one of the category listetd i Category list.

 

I tried as follow:

 

 

Clear(_dataResult);;

ClearCollect(
    _dataKlassifiseringer;
    LVL_HSEQ_Klassifisering
);;

ClearCollect(
    _dataRapporter;
    LVL_Kvalitet_Forbedring
);;

ForAll(
    _dataKlassifiseringer;
    Collect(
        _dataResult;
        {
            ID:ID;
            Title:Title;
            Antall: CountIf(LVL_Kvalitet_Forbedring;klassifiseringsID=ID)
            
        }
    )
)

 

 

I have tried CountRows(Filter(....)), with same result, allways 1 for each item. The result is as follow:

TurboTape_0-1610037614761.png

 

Column 3 is the Antall from code above. Column 4 is coded in a textbox inside the gallery and give me the correct result I want, but its useless when its calculated inside the gallery. All these codes should run in the background onVisible or onStart and display a graph on the dashbord for the user. 

 

Any help, tip or alternative methods is greatly appreciated. 

 

Best Regards

Tommy



1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@TurboTape 

You will need to shape your data in the Items property.

Something like this:

ShowColumns(
    AddColumns(
       Gallery22.AllItems,
       "_antall", Value(theNameOfTheTextBoxInYourGallery.Text)
    ),
    "Title",
    "_antall"
)

This will provide a table of records with a Title (for Labels) and a _antall (for Series) to the Items of your pie chart.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@TurboTape 

So you mention that it is useless in the Gallery...why is that?

You can have your graph get its data from that Gallery if you already have the values there that you want.

 

In other words, there is no need for all of these collections if you already have the values you want in your Gallery...the Gallery is already a table.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi RandyHayes

 

Thanks for reply :).

 

That was my second plan, but they are not available as series in the pie chart. Maybe I'm doing something wrong here?:

TurboTape_0-1610092047257.png


I tried textbox and input box, but they are not recognised. Maybe I can patch the gallery to a table or something.

What I would like to know is, if it is impossible to to anything like I initially tried to or not. If its not possible I can use time to try to make a gallery and patch it to a collection in the background. 

 

Best regards

Tommy

 

RandyHayes
Super User
Super User

@TurboTape 

You will need to shape your data in the Items property.

Something like this:

ShowColumns(
    AddColumns(
       Gallery22.AllItems,
       "_antall", Value(theNameOfTheTextBoxInYourGallery.Text)
    ),
    "Title",
    "_antall"
)

This will provide a table of records with a Title (for Labels) and a _antall (for Series) to the Items of your pie chart.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,128)