The date is in the correct format ie YYYY-MM-DD. If I sort just on date it sorts to correct order however if i sort on another field first with date the second criteria it is sorted correctly on first criteria but the date is sorted by DD first MM second and YYYY last. Out of curiosity I tried the same file in Excel which sorted correctly. Can anyone explain the difference and how to get a correct sort in Calc? Using 2 criteria in Calc does not work. I tried sorting on date first and species second. Date order was correct but species were jumbled.
The data is a spreadsheet download of an online data base where we record squirrel and other species sightings in the forest. The entries are not in date or species order. There are many fields for each entry but I am trying to sort first to species and then each species to be in date order. It is for an animation using Time Manager.
I have re-asked the question with edit because the question was closed, for what reason I don't know.
The sort does work correctly, tried again and all sorted as it should. Tried to reproduce strange date order but can't. Have no idea what went wrong originally.
Related
I have a recordset where rows have a date field.Rows are from current year and last year. I want to see the count of rows per year. That's easy. Now I'd like to have a third column with difference (count(currentYear) - count(lastYear)). Is there any way to achieve this?
thanks
It seems like you want to have the difference calculated between two members of the same date field.
If so, you might want to consider the customizeCell() API call to retrieve the count values of each year, use them to calculate the difference, and modify the necessary cells with the result.
Alternatively, you could try modifying your data set so that the lastYear and currentYear are two different fields – this, for example, would allow you to compare them within a calculated value.
I have a problem with sorting my columns in my matrix by month order. I have read many, many posts on problems where the results are alphabetical but none where it starts at the wrong month.
I am using a calculated field called MonthSort using expression:
=FORMAT(Fields!createdon.Value,"yyyyMM")
And I have then Sorted by MonthSort in the Column Group (Group Properties) Sorting Option.
This is something that I have used frequently and in the past it has always sorted from Jan to Dec correctly. However this time it is sorting from November to October.
In my query I am pulling data with the following WHERE clause and I am wondering if this is affecting the starting month.
AND (createdon BETWEEN '2016/11/25' AND DATEADD(minute, - 1, #EndDate + 1))
Any help would be gratefully appreciated.
Out of curiosity, what happens if you change the sort expression to =FORMAT(Fields!createdon.Value,"MM")
Your sort expression
=FORMAT(Fields!createdon.Value,"yyyyMM")
gets you data in the format 201611, 201612, 201701,... so the sort works correctly.
I'm stuck with sorting and showing the correct date in Xpages.
It is saved in format "dd.MM.yyyy" and it's a string.
Now why it's a string and formated that way, is because my boss has special wishes. And when I want to sort it from the newest date to older it does something like this:
26.05.2015
24.06.2014
22.04.2015
21.04.2015
20.03.2014
It starts sorting by day.
Is there a way to make it sort it like it should?
I see that i can write a Computed value to Sort column in view column header for date. But i don't know how to even start.
Change the underlying Notes view to get your date column into right order.
Convert the date strings to real date values in views column formula. Assuming your field is called DateText then your formula would be
#Date(#ToNumber(#Right(DateText; 4));
#ToNumber(#Middle(DateText; 3; 2));
#ToNumber(#Left(DateText; 2)))
It would be easier to use just #ToTime(DateText) but this can fail depending on server's local settings. Your date string format would work for a server with German locale settings but not for US. That's why is my suggested solution "safer".
If the date time value doesn't solve your problem and you do not transform your date via #Text (as mentioned in the comments) then create another (hidden) column BEFORE your column that should be displayed. Make this a true date (from your item), sort it and unsort the column to display.
Otherwise use this formula in the newly created sorted column:
#Text(#Year(yourDate))+"-"+#Right("00"+#Text(#Month(yourDate));2)+"-"+#Right("00"+#Text(#Day(yourDate));2)
I am trying to sort months into PowerBI Designer Preview, it looks like it only can be done alphabetically. But when I look on the internet at images of PowerBI it looks like they are all sorted correctly. Can somebody help me? And there must be other people who are facing this problem right?
Thank you in advance.
Check what is the data type of the column you are trying to sort. If it's Text then it would sort alphabetically, irrespective that these are numbers. Make sure it's Date or Number to sort correctly.
In Power Pivot, you can set a sort by column. This hints Power Pivot to sort a given column like a column of month names by another column like a column of integers representing the order of month names. The pattern is to create a Date table - a table with all of your dates. In this date table you create a column with month names and another column with month indexes. Then you select the column with month names and set the sort by property to the month indexes column. Usually, I like to create a 'MonthYear' column that has values like "Dec-14", "Jan-15" etc. this then allows me to sort correctly across years.
Ok, I've seen similar questions on here, but nothing exactly the same. I am creating reports based on a cube that reads data from a DW. A lot of the reports tend to be along the lines of Value by Something By Week or Value By Something By Month. Everything seems ok, but the week and month (columns) don't order correctly. Week 10 goes before Week 9, February comes before January, etc. Im very frustrated bc I can't get these things to work correctly.
To add to this, at some point my customer needs to be able to write their own reports against the cube using Reportbuilder 3.0. So, I am reluctant to rely on manually editing the query. SURELY there is some obvious way to do this. In my DimDate I have a weekname that is a varchar, a week that is date, etc. Same for month.
Im missing something obvious here.
Thanks!
The sort order would make sense (varchars are strings {"Week 10", "Week 9"}, and {"February", "January"}) in that they are coming before their respective pair in the examples you've given, assuming an ASCII type of sort on the string values.
There are multiple ways to have ascending sort with strings as column headers (assuming ASCII type sorting on the string field):
Ensure week numbers are two digits in length e.g. "Week 9" would become "Week 09". This will ensure that the week columns are sorted in ascending order (or descending order, which ever is the case).
Add a month number in front of the month name e.g. "01 January", "02 February" -> You will still need two digit month numbers otherwise you will get the same issue you had with week numbers.
Use formatted dates as opposed to strings, as dates will be sorted properly.
Alternatively, if the issue is being caused in the dimension within the cube you can ensure any order by clauses are on keys, and not name fields.