I have a dropdown menu, which accesses an Excel sheet called Clothes
and takes in the distinct values from the column Color
and then sorts them in ascending order with the following statement:
Sort(Distinct(Clothes,Color),Result,Ascending)
My Color
column contains the following values:
Green
Blue
Grey
Red
Yellow
Pink
What I wanna do is filter the colors that contain the color letter g inside them in the dropdown. I would like for instance to only see Green
and Grey
after applying the filter. I tried the following:
Sort(Distinct(Filter(Clothes, "g" in Lower(Color))),Result,Ascending)
But I get an error saying:
The function 'Sort' has some invalid arguments. Invalid number of arguments
received 1, expected: 2
Can someone help me understand what I am doing wrong? Thanks in advance for any help you can provide
it looks like your distinct function is lacking a required argument! According to the Distinct reference docs found here, the Distinct function takes a Table argument, and a Formula argument. Your Table argument is the result of the Filter being applied, the Formula may be something like the column name you are trying to get distinct values from. In your case, most likely 'Clothes'.
Sort(Distinct(Filter(Clothes, "g" in Lower(Color)), <Formula goes here>),Result, Ascending)
Here is the example on how Distinct works from the documentation mentioned above.
Example
If you had an Employees table that contained a Department column, this function would list each unique department name in that column, no matter how many times each name appeared in that column:
Distinct(Employees, Department)