I am using Ext 4.x. I have a list of records and several columns. The first column is called Project Name. I have 5 records: Apple, Grapes, Banana, Zucchini, Kiwi. If I apply a filter (say "Fruits") to the records, then only the following records are displayed: Apple, Grapes, Banana, Kiwi. If I then apply ascending sort to the Project Name column, the fruits are displayed in the following order: Apple, Banana, Grapes, Kiwi. However, if I now remove the filter, I see all the 5 records in the following order: Zucchini, Apple, Banana, Grapes, Kiwi instead of Apple, Banana, Grapes, Kiwi , Zucchini. The ascending sort should still apply to the column and indeed the ascending sort arrow icon is displayed in the column header. However, the sort is not in the ascending order (Zuchini comes first, followed by the fruits which are in ascending order). Is this a bug? I need the column to remember and adhere to the sort order and after filtering display the (new/additional) records in that sort order. Anyone any thoughts on this?
clearFilter() does not apply sorting. You can call grid.store.sort(); if you want the store to sort properly.
Example: http://jsfiddle.net/Vandeplas/5aKdc/4/
Note:
Watch out if you use remote sorting... Remote sorting performs a call to the backend, you'll have to make sure the right properties are sent.
Related
I have preview of matrix like this:
Columns "Report#" and "Headline Indicator" are added manually, "Report Month" is number of month that is used for row grouping, "1" and "3" are column group fields (department_key_id). Design on the picture below:
I want to sort data by first column "Report#".
I tried to configure some interactive for that column but it was not worked for me(
How can I sort rows with data in the table in this way - 2, 2, 3, 3, 4, 4, 5, 5?
thanks!
So it looks to me like you might need a couple of changes to get the set-up you want here. First, I'm going to recommend adding an ORDER BY [report_month_num] to your query and you can do away with the current row grouping on report_month_num.
You'll need to add a Detail grouping row for each of your four rows. So right click in any textbox, navigate to Add Group > Row Group > Adjacent below. Make sure to select Show detail data for each of the four groups you make. You'll need to copy the data into the new rows and you should be all set.
This should ensure the ordering you are expecting.
I need to sort a very long list fields in Power BI that I need in a special order - not the default sort by name/number.
My dataset looks like this:
and I created another table to use for sorting:
I am stuck from here. I think I need to create a relation between the to tables and then use it to sort the field list. But I do not know where to start.
The order I have now looks like this:
Assuming you're sorting in Power Query, then:
1 Sort table SortOrder by column SortOrder:
= Table.Sort(#"Previous Step",{{"SortOrder", Order.Ascending}})
2 Sort table Data by list SortOrder[ColumnName]:
= Table.Sort(#"Previous Step",SortOrder[ColumnName])
EDIT
It seems you're actually asking how to change the order in which fields are displayed in the Fields Pane
This is currently not possible - fields are always displayed in alphabetical order.
You may vote for this feature request: https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/18355429-use-field-order-as-ordered-in-source-query
The only workaround just now would be to rename your fields so they display in your required order - eg:
01_ClmName_A
02_ClmName_C
03_ClmName_E
04_ClmName_B
05_ClmName_Q
06_ClmName_F
The Problem
Given a database of 10,000 items, I would like to go about doing the following:
search by any of the columns
match results by a variable number of letters at the beginning of the result
print out duplicate results
the rest of the information for that entry is appended to the search
Consider the table in ms-access (omitting the primary key)
Header1|Header2|Header3
apple rotten green
apple fresh yellow
pear fresh blue
orange rotten pink
Given the following search by Header1; apple, pear
I would receive the result:
apple, rotten, green
apple, fresh, yellow
pear, fresh, blue
Similarly, given the search by Header1; pear, orange, pear
I would receive the result:
pear, fresh, blue
orange, rotten, pink
pear, fresh, blue
What I'm doing
My approach is to store the header you are searching for and an array containing the elements that you searched for. I retrieve the WHOLE database (it's large so this wouldn't be the preferred method) and order it by the header chosen, and also sort the input that the user gave me (both lists in ascending order).
By using simple comparisons (strComp = 0, -1, 1) I increment counter variables for the respective list. This, however, does not account for the cases where the user inputs a duplicate AND the table has a duplicate result. It only accounts for one or the other of those cases.
My solution to that issue would be to "roll" up and down when we find a result to check for nearby results as well, but that seems horrible, nor does it account for fuzzy string matching.
Any recommendations? The solution should somehow stay O(n) if possible given that the user input can (and will) be > 100,000
I suggest you construct a dynamic UNION ALL query, with one SELECT statement for each search.
UNION ALL returns all rows, including duplicates.
e.g.
SELECT * FROM myTable WHERE Header1 LIKE 'apple*'
UNION ALL
SELECT * FROM myTable WHERE Header1 LIKE 'pear*'
UNION ALL
SELECT * FROM myTable WHERE Header1 LIKE 'apple*'
With indexes on the columns that are searched, this should be reasonably fast.
My solution;
First: Store the data (comma delimited) from the database in a dictionary as value with the key being the value for the searched header. If an entry already exists, simply append the new data to the previous data with a bar delimiter.
Second: loop through the list of inputs and match them (with a simple first N characters comparison - if necessary) with the items in the dictionary. If you found a match, get the value and split by delimiters accordingly.
I believe this stays an O(n) solution so long as the first N characters comparison is not used.
I have a column with thousands of dates in it. I'd like a row of each unique date sorted in ascending order. This column has been named create_date. So:
=transpose(unique(create_date))
produces results that looks like this:
6/1/2012 5/1/2008 7/1/2008 3/1/2010 1/1/2011 6/1/2011
But I wanted the range sorted in ascending order from left to right. So I tried nesting my formula in a sort function like this:
=sort(transpose(unique(create_date)),1,TRUE)
I've never used sort before. The function didn't produce an error, but didn't actually change anything, the results are as they were before being wrapped ins sort.
Using formula (I could easily do this manually), how would I sort a column of dates to read from left to right in ascending order?
Please try:
=unique(transpose(sort(create_date,1,true)))
Had to tweak #pnuts answer a little. This appears to work:
=transpose(sort(unique(create_date),1,true))
I have this table:
When executed, it looks like:
This table is sorted by alphabetical order. I would like to sort it by the column named "No Vencido", which is generated in runtime combining 2 dimensions of a cube (one dimension is called "Class 1", the other dimension is called "value".
How can i sort a table by an autogenerated field?
Thanks
You can sort by any sort of expression - SSRS will quite happily sort something like two fields concatenated together:
=Fields!Class1.Value & Fields!value.Value
Just be careful to make sure the sorting is applied at the appropriate level to avoid unexpected, i.e. make sure you don't have different sorting expressions in any row group or detail group if not required.
If No Vencido is the grouping expression, apply the sorting at the group level.
If you don't want to sort on an expression, you can create a calculated field for each row in the dataset with the expression =Fields!Class1.Value & Fields!value.Value and group/sort on that calculated field as required.
Edit after comment
OK, I think you need to apply a sort expression like this to the groups that apply to the Top and Otros rows:
=Sum(IIf(Fields!Clase_1.Value = "No Vencido", Fields!Monto.Value, Nothing))
This is still sorting by the total Monto for each row group, but only considering the rows where Clase_1 is No Vencido.
Once this is set up sort by A-Z or Z-A as required.