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

Create a collection (Job Titles per Department) from Office365

Is it possible to create a collection having Job Titles per Department from Office365Users?

 

Thanks a lot!

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@cgarib 
Here is some code you can plug into your Power Apps to create a unique list of departments and titles.

ClearCollect(
    colDeptTitles,
    SortByColumns(
        ForAll(
            Distinct(
                ShowColumns(
                    Office365Users.SearchUserV2({top: 999}).value,
                    "Department",
                    "JobTitle"
                ),
                ThisRecord
            ),
            ThisRecord.Result
        ),
        "Department",
        Ascending,
        "JobTitle",
        Ascending
    )
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

2 REPLIES 2
mdevaney
Super User III
Super User III

@cgarib 
Here is some code you can plug into your Power Apps to create a unique list of departments and titles.

ClearCollect(
    colDeptTitles,
    SortByColumns(
        ForAll(
            Distinct(
                ShowColumns(
                    Office365Users.SearchUserV2({top: 999}).value,
                    "Department",
                    "JobTitle"
                ),
                ThisRecord
            ),
            ThisRecord.Result
        ),
        "Department",
        Ascending,
        "JobTitle",
        Ascending
    )
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

cgarib
Frequent Visitor

Works really fine!... tnaks a lot!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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