cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
simms7400
Post Prodigy
Post Prodigy

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

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

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
SeanHenderson
Impactful Individual
Impactful Individual

Try on the combobox

 

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

 

 

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

@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.

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.

v-xida-msft
Community Support
Community Support

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.

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!

@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!

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

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (67,195)