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

Distinct functions says expected a text value

Dear Experts, 

 

It seems like I still do not understand some small things like distinct functions. 

 

What could be the reason? 

 

Capture.JPG

Osmand

2 ACCEPTED SOLUTIONS

Accepted Solutions

What formula do you have on the Gallery items?

The Distinct formula should be on the Items of the Gallery.

 

Then the Text of the Label inside the Gallery could be:

ThisItem.Result

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

I found it. 

Filter(Distinct(AllOrderDetails,'Model Number'),ModelN.Text in Result.Value)

 

Osmand

View solution in original post

9 REPLIES 9
KroonOfficeSol
Resident Rockstar
Resident Rockstar

Distinct() formula you would use to return a single column list with unique values. So in your case, you would do

Distinct(OrderDetails, 'Model Number')

This would return a list of Unique Model Numbers.

 

This you would use in a DropDown or ComboBox, so you can select one of more of the model numbers. Then this control you would use for example to filter a gallery.

 

What is your use case for which you like to use this formula?

@KroonOfficeSol  Thank you for your quick reply. 

 

I tried it but still the same. under the result I see as Record. But still the same error. 

 

I am trying this under a Gallery with a label. 

 

Osmand

use:
Distinct(OrderDetails,'Model Number')

 

More on Distinct:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-distinct

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

This is not logic to use in a gallery I would say. Tell us more about you goal and make some more screenshots from the gallery and controls.

@KroonOfficeSol  @eka24 

This is my Inventory balance report. I am using a Gallery. Added a label to get the Model numbers from Orderdetails. But I want there are Distinct values. I can use the ThisItem option but that will give me all. (Duplicates)

 

Capture.JPG

 

Osmand

What formula do you have on the Gallery items?

The Distinct formula should be on the Items of the Gallery.

 

Then the Text of the Label inside the Gallery could be:

ThisItem.Result

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

In your case you could better use the GroupBy() formula. What this does is that it groups based on your Model Number, but nested for each Grouped Item a table for all the records which are held in the group (hope this makes sense). 

 

This because you probably like to calculate the number of items, amount of costs or whatever you like to show.

 

Also you could then select an item to navigate to another screen and put a gallery there connected to the gallery,selected.GroupName. Which then will return a table of the records which were grouped with the model number.

 

Distinct() you only use when you want to have a single column list on a dropdown or combobox.

 

Hope this helps.

@eka24  Thank you it is working fine, but on the other hand i lost my search option. How can I include the serach capabilities while having the Distinct option

 

Capture.JPG

Osmand

I found it. 

Filter(Distinct(AllOrderDetails,'Model Number'),ModelN.Text in Result.Value)

 

Osmand

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

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (98,782)