cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
simms7400
Level 8

Assistance with Distinct Function

Hi Folks -

 

I am having a situation trying to use a Distinct function.

 

For some background, here is a collection I am using:

	   Collect(
				PartnershipList,
				ShowColumns(
							Filter(
								   RD_Partnership_List,
								   Not(Governance_Status="Terminated")
							 ),
							"Parent_Node", "Parent_Alias","Name","Alias"
				)
	   )

 

I guess first off, is there a way to add the Distinct function to the above collection?

 

Otherwise, I need to add the Distinct function to my Items property of the ComboBox I use this Collection in.

 

Here is the formula I am using in the Items property of the ComboBox:

Sort(PartnershipList,Alias,Ascending)

 

If I can't add the Distinct to the collection above, I will need to add it to the above formula.

 

Thank you for your help!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Assistance with Distinct Function

Hey @simms7400 

 

The function will operate only the alias column and it will not look for the distinct values in the other columns. You can apply groupby on multiple columns, but that will just complicate the expressions and control usage. If you want to select different values, you can try to build cascading dropdown/combobox and this will only show the associated values corresponding to selections in the previous controls.

Try the below expression if this is easier to handle with the existing configuration:
Collect(PartnershipList,GroupBy(ShowColumns(Filter(RD_Partnership_List,Not(Governance_Status="Terminated")),"Parent_Node", "Parent_Alias","Name","Alias"),"Parent_Node", "Parent_Alias","Name","Alias", "Grouped"))

This will group the controls based on distinct in all the four columns.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Community Support Team
Community Support Team

Re: Assistance with Distinct Function

Hi @simms7400 ,

Please consider take a try to apply the GroupBy function to your collection:

Collect(
	PartnershipList,
	GroupBy(
                 ShowColumns(
		          Filter(
			         RD_Partnership_List,		 
                                 Not(Governance_Status="Terminated")
		           ),
		          "Parent_Node", "Parent_Alias","Name","Alias"
	         ),
                 "Parent_Node",
                 "Parent_Alias",
                 "Name",
                 "Alias",
                 "GroupData"
        )
)

 

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

10 REPLIES 10
SKH19
Level 10

Re: Assistance with Distinct Function

Try on the combobox

 

Sort(Distinct(PartnershipList, Alias), Result, Ascending)

 

 

simms7400
Level 8

Re: Assistance with Distinct Function

Thank you. I tried that but it changes the property to display "Result" instead of "Alias".

Eelman
Level 10

Re: Assistance with Distinct Function

@simms7400 seems you are trying to create a collection with 4 columns where you only show distinct values for 'Alias', is this correct? The Distinct() function only returns a 1 column collection and "Result" is it's column heading. Seems this maybe the wrong option.

 

I think you may be better looking at the GroupBy() function? I've only played around a little with this function so can't offer a solution other than maybe try looking into using it, sorry.

simms7400
Level 8

Re: Assistance with Distinct Function

Hi -

 

No, I'm trying to make all column Distinct I use each of those columns on different comboboxs.  So making it distinct in the Collection would be easiest.

Community Support Team
Community Support Team

Re: Assistance with Distinct Function

Hi @simms7400 ,

Could you please share a bit more about your scenario?

Do you want to apply a Distinct function to your collection, and still could choose the "Alias" column in your ComboBox?

 

Based on the needs that you mentioned, I think the Distinct function could not achieve your needs. As an alternative solution, I think the GroupBy function could achieve your needs.

 

1. Apply the "GroupBy" function to your collection:

Collect(
	PartnershipList,
	GroupBy(
                 ShowColumns(
		          Filter(
			         RD_Partnership_List,		 
                                 Not(Governance_Status="Terminated")
		           ),
		          "Parent_Node", "Parent_Alias","Name","Alias"
	         ),
                 "Alias",
                 "GroupData"
        )
)

2. Apply the "GroupBy" function to the formula within your ComboBox's Items:

Sort(
      GroupBy(PartnershipList, "Alias", "GroupData"),
      Alias,
      Ascending
)

 

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.
Dual Super User
Dual Super User

Re: Assistance with Distinct Function

Hi @simms7400 

 

If you want to distinct out the alias in the collection itself, can you try to update the expression as:

Collect(PartnershipList,AddColumns(GroupBy(ShowColumns(Filter(RD_Partnership_List,Not(Governance_Status="Terminated")),"Parent_Node", "Parent_Alias","Name","Alias"),"Alias", "Grouped"),"Parent_Node1",First(Grouped).Parent_Node, "Parent_Alias1", First(Grouped).Parent_Alias, "Name1", First(Grouped).Name))

To access the values for Parent_Node, Parent_Alias and Name, you have to use Parent_Node1, Parent_Alias1 and Name1 respectively.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

simms7400
Level 8

Re: Assistance with Distinct Function

@yashag2255 

 

Hi! Thank you very much! So your formula only Distincts the Alias? Ultimately, I would like all (4) columns to be distinct so I didn't have touch the individual ComboBoxs on my forms.

 

Is there  a way to make all Columns Distinct from my collection?  If so, is there a way to keep the names as is? Otherwise I will need to update my forms in many places. Not the end of the world, just time consuming.

 

Thank you!

Highlighted
Dual Super User
Dual Super User

Re: Assistance with Distinct Function

Hey @simms7400 

 

The function will operate only the alias column and it will not look for the distinct values in the other columns. You can apply groupby on multiple columns, but that will just complicate the expressions and control usage. If you want to select different values, you can try to build cascading dropdown/combobox and this will only show the associated values corresponding to selections in the previous controls.

Try the below expression if this is easier to handle with the existing configuration:
Collect(PartnershipList,GroupBy(ShowColumns(Filter(RD_Partnership_List,Not(Governance_Status="Terminated")),"Parent_Node", "Parent_Alias","Name","Alias"),"Parent_Node", "Parent_Alias","Name","Alias", "Grouped"))

This will group the controls based on distinct in all the four columns.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Community Support Team
Community Support Team

Re: Assistance with Distinct Function

Hi @simms7400 ,

Please consider take a try to apply the GroupBy function to your collection:

Collect(
	PartnershipList,
	GroupBy(
                 ShowColumns(
		          Filter(
			         RD_Partnership_List,		 
                                 Not(Governance_Status="Terminated")
		           ),
		          "Parent_Node", "Parent_Alias","Name","Alias"
	         ),
                 "Parent_Node",
                 "Parent_Alias",
                 "Name",
                 "Alias",
                 "GroupData"
        )
)

 

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

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (6,004)