cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SaeedKamel
Frequent Visitor

Get distinct from 2 columns and sum the unique values

Hi Everyone

I have the below database and i want to to put it in a gallery that each section of this gallery has the name of the Department and the unique sum of the employee of each Department  

Table1: to get the name of each department into the gallery using ThisItem 

THDepartmentTHBudgetId
MarketingB
TechnologyC
AccountingE
HRH

 

this to get the calculations

EmpIDTHDepartmentTHBudgetId
553CareC
226TechnologyC
779CareC
553CareC
226TechnologyC
2210CareC
553CareC
5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @SaeedKamel ,

Try the below, however the output of GroupBy is limited by Delegation, so it may not give you the totals you need.

AddColumns(
   GroupBy(
      YourListName,
      "THDepartment",
      "THBudgetID",
      "OtherData"
   ),
   "EmpID",
   CountRows(OtherData)
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz Thank you for the reply 

but i get this error message

" Expected Text Value"

HI @SaeedKamel ,

Where did you put that code - as the Items of a Gallery, it will show the number of unique records with the combination of THDepartment and THBudgetID. and is valid code for this (I also just tested it here).

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz I am trying to add the code in the Spent Filed to calculate the unique values

@SaeedKamel ,

The code I gave you is for the Items of your Gallery and should produce (with the field names you requested) the results you displayed as required.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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