cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

CountIf and Sum based on the Combo box selection

Hi, 

 

I am almost done with my Loan module. Now I am working on the Loan dashboard. I want to get Count of Active number of Loans based on the year selected from a drop down. 

 

In the Loan Table I have a calculated column for the Year based on the Loan Date, but it is in Number format. 

 

Osmand

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: CountIf and Sum based on the Combo box selection

HI @OsmandFernando ,

Do you also want to apply the same Year Dropdown filter to your several labels?

 

I have made a test on my side, please consider take a try with the following workaround:

Active loans:

CountIf('Loan Table','Loan Status'.Value="Open" && Round(Value(Year), 0) = Value(Dropdown2.Selected.Value))

Total Loan Outstanding:

 Text(
        Round(
              Value(
                    Sum(
                         Filter('Loan Table',  Round(Value(Year), 0) = Value(Dropdown2.Selected.Value)),     // Modify here
                         'Total Outstanding'
                    )
              ),
              2
        ),
        "[$-en-US]#,###.00#"
)

Total Interest Earned:

Text(Round(Value(Sum(
                      Filter('Loan Recoveries', Round(Value(Year), 0) = Value(Dropdown2.Selected.Value)),  // Modify formula here
                      'Interest Received'
                    )
                 ),
      2),
     "[$-en-US]#,###.00#"
)

Total other income Earned:

Text(Round(Value(Sum(
                     Filter('Loan Recoveries', Round(Value(Year), 0) = Value(Dropdown2.Selected.Value)),  // Modify formula here
                      'Other Charges'
                  )
           ),
      2),
      "[$-en-US]#,###.00#"
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Community Support Team
Community Support Team

Re: CountIf and Sum based on the Combo box selection

Hi @OsmandFernando ,

Could you please share a bit more about the Year value Dropdown that you mentioned?

Could you please show more details about the data structure of your Loan Table?

Could you pleshare share a bit more about your 'Loan Table'? Is it a SP List or a Excel table?

 

Based on the formula that you mentioned, I have made a test on my side, please consider take a try with the following formula:

CountRows(Filter('Loan Table', Year('Loan Date') = Value(YearDropdownBox.Selected.Value)))

If the 'Loan Table' is a SP List, and there is a Choice type column in your Loan Table to store the status value ('Active' or 'InActive') for each Loan record, please consider modify above formula as below:

CountRows(
          Filter(
                  'Loan Table', 
                   Year('Loan Date') = Value(YearDropdownBox.Selected.Value),
                   Status.Value = "Active" // If the Status column is a Text column, please type Status = "Active" formula here
          )
)

Note: The Status represents the Choice column in your SP List, which is used to store the status value for each Loan record. I assume that the Year value within the Dropdown box listed as '2017', '2018', '2019', ....

 

Please note that if the 'Loan Table' is a Excel table, you do not specify a Calculated field within your Table, because, connecting to a Excel table including Calculation field is not supported in PowerApps.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Re: CountIf and Sum based on the Combo box selection

@v-xida-msft  Thank you so much for your reply. 

 

With all of your help I have come a long way. Now in the dashboard When I select the Year my reports (all) should be filtered based on the Year Dropdown. 

 

  • Chart is based on a Collection. That collection is having the Loan date, also Year
  • Also rest of the information having the date where I can get the year. 

 

 

Capture.PNG

 

Osmand

 

Community Support Team
Community Support Team

Re: CountIf and Sum based on the Combo box selection

HI @OsmandFernando ,

Have you taken a try with the solution I provided above? Is it helpful on your scenario?

Do you want to filter your Chart records based on the selected year value within the Dropdown box?

 

If you want to filter your Chart records based on the selected year value within the Dropdown box, please take a try with the following workaround:

Set the Items property of the Pie Chart control to following:

Filter(CollectionTable, Year('Loan Date') = Value(YearDropdownBox.Selected.Value))

or

Filter(CollectionTable, YearColumn = Value(YearDropdownBox.Selected.Value)) // I assume that the YearColumn is a Number column in your CollectionTable

 

Please consider take a try with above solution, then check if the issue is solved. If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Re: CountIf and Sum based on the Combo box selection

@v-xida-msft  I tried your 1st formula with a minor change as below, 

 

Filter(LoanChartNew, Year = Dropdown2.Selected.Value)

 

Formula does not show any error but Pie chart is blank. 

 

Initially the text property set as LoanChartNew.Total_x0020_Outstanding

 

Osmand

 

Community Support Team
Community Support Team

Re: CountIf and Sum based on the Combo box selection

Hi @OsmandFernando ,

Please consider modify your formula as below:

Filter(LoanChartNew, Text(Value(Year), "###") = Text(Dropdown2.Selected.Value))

or

Filter(LoanChartNew, Round(Value(Year), 0) = Value(Dropdown2.Selected.Value))

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Re: CountIf and Sum based on the Combo box selection

@v-xida-msft 
It worked for the chart and the the table. I have several labels where I have summary details such as , 

 

Total Active Loans, 

Total Interest Earned

Total Outstanding

 

How can I apply the same Year dropbox filter to those ?

Formulas set as follows

Active loans = CountIf('Loan Table','Loan Status'.Value="Open")

Total Loan Outstanding = Text(Round(Value(Sum('Loan Table','Total Outstanding')),2),"[$-en-US]#,###.00#")

Total Interest Earned = Text(Round(Value(Sum('Loan Recoveries','Interest Received')),2),"[$-en-US]#,###.00#")

Total other income Earned = Text(Round(Value(Sum('Loan Recoveries','Other Charges')),2),"[$-en-US]#,###.00#") 

 

 

Capture.PNG

 

Osmand

Community Support Team
Community Support Team

Re: CountIf and Sum based on the Combo box selection

HI @OsmandFernando ,

Do you also want to apply the same Year Dropdown filter to your several labels?

 

I have made a test on my side, please consider take a try with the following workaround:

Active loans:

CountIf('Loan Table','Loan Status'.Value="Open" && Round(Value(Year), 0) = Value(Dropdown2.Selected.Value))

Total Loan Outstanding:

 Text(
        Round(
              Value(
                    Sum(
                         Filter('Loan Table',  Round(Value(Year), 0) = Value(Dropdown2.Selected.Value)),     // Modify here
                         'Total Outstanding'
                    )
              ),
              2
        ),
        "[$-en-US]#,###.00#"
)

Total Interest Earned:

Text(Round(Value(Sum(
                      Filter('Loan Recoveries', Round(Value(Year), 0) = Value(Dropdown2.Selected.Value)),  // Modify formula here
                      'Interest Received'
                    )
                 ),
      2),
     "[$-en-US]#,###.00#"
)

Total other income Earned:

Text(Round(Value(Sum(
                     Filter('Loan Recoveries', Round(Value(Year), 0) = Value(Dropdown2.Selected.Value)),  // Modify formula here
                      'Other Charges'
                  )
           ),
      2),
      "[$-en-US]#,###.00#"
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Re: CountIf and Sum based on the Combo box selection

@v-xida-msft  Thank you so much, It worked perfectly. I included All option to dropdown and further modified it to see all data when I select "All"

 

Working very well. Thank you so much for make things happend.

 

Osmand 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (7,118)