open office sort - month and year - openoffice-calc

I just want to sort this based on Month and year combination (that is, based on column A) ascending. How to do this in OpenOffice Calc? The sort option on month is not working because I guess the year is also appended.
Here are some data starting from A1:
Month Total
September 2011 27825
September 2010 35801
October 2011 108485
October 2010 22223
November 2011 139222
May 2012 39319
May 2011 38226
May 2010 9671

There are different solutions:
You could transform the values of column A as dates so OpenOffice / LibreOffice can sort them accordingly (see Solution 1 below);
You could split the text values into two columns (month and year separately) and sort first for year, then for month (see Solution 2 below).
Solution 1
Select the cells holding the month/year values;
Select Menu Format -> Cells... -> Numbers;
Select Date from left list;
Enter the following format code in the Format Code field: MMMM YYYY
Hit OK
With the cells still selected, select Menu Edit -> Find & Replace... or hit CTRL+H
In field Search for, enter a single dot, and in field Replace with an ampersand (&) ; hit More Options, tick Regular Expression. Select Replace all:
Select cell A1, apply sorting using Menu Data -> Sort by column A ("month").
As result, OpenOffice / LibreOffice transforms the values of column A into dates (for example, 01/09/2011 instead of September 2011). The displayed cell content will stay "September 2011" because of the custom cell format using the code MMMM YYYY. When sorting, OpenOffice / LibreOffice recognizes the dates and sorts by month/date.
Solution 2
Insert a new column next to col A for the year values: select column B, select Menu Insert -> Columns;
Select column A, select Menu Data -> Text to Columns...
In the following dialogue, select Space as delimiter, then hit OK;
Add Year as header in cell B1;
Select cell A1, select Menu Data -> Sort; select first year, then month; don't hit OK yet (otherwise the months would get sorted alphabetically), but select Options -> Custom sort order; select the months sort order. Now, hit OK.

Related

Clean Data in Power BI

i need help on cleaning this data. Currently I've no idea to clean this kind of data. I want to clean based on month and total per supplier. Thanks
Select the first 2 columns [No] and [Supplier]
On the tab Transform drop down Unpivot Columns and click on Unpipot Other Columns
This converts your wide pivot table into a long, stacked format that is ideal for further processing.
Another way you can achieve this is
Select all the date columns.
Click on the transform tab, under any column section, click on unpivot only selected columns
Kindly rename the Attribute column to date
If you need to split the date column into month and year
4. on the transform tab, under the text column section, click on Split Column, select "by delimiter" on the dialog box, select split at the left-most delimiter and click ok.
You will have your month and year columns as shown below
if your value column holds figure for amount/money you can transform the data type and replace the null values with zero using the replace values function when you right-click on the values column.
I hope this helps

Show dynamic days with Month Dates in a Oracle Apex Grid Heading

I want to update Interactive grid Column Heading Name dynamically in oracle apex on the basis of month selected from list.
For example I have selected August from Month LOV then the column heading should be display like this.
01/MON, 02/TUE, 03/WED .............. 28/SAT,29/SUN,30/MON.
Previous Research
Code: I try to CONCATENATE date like this.
---------------For First Column Heading-----------
SELECT '01'||' / '|| TO_CHAR(:P152_START_DATE,'DAY')
FROM DUAL;
---------------For First Column Heading-----------
SELECT '02'||' / '|| TO_CHAR(:P152_START_DATE+1,'DAY')
FROM DUAL;
This is the interactive grid having column heading from 01-Aug-2021 to 31-Aug-2021.
A column header supports substitutions, so this is one solution.
Create 31 page items P152_COL1 up to P152_COL31.
Set page item for each column heading using substitution syntax (example &P152_COL1. )
Create a page process to populate the column header page items
BEGIN
FOR r IN
(SELECT TO_CHAR(TRUNC(TO_DATE(:P152_START_DATE, 'DD-MON-YYYY'),'MM') + level - 1,'DD/DY') AS wd,
TO_DATE(:P152_START_DATE, 'DD-MON-YYYY') + level - 1 as dt,
level - 1 as rn
FROM dual CONNECT by level < 32)
LOOP
--only include the days of the selected month, else print "-"
IF TRUNC(r.dt,'MM') = TRUNC(TO_DATE(:P152_START_DATE, 'DD-MON-YYYY'),'MM') THEN
APEX_UTIL.SET_SESSION_STATE('P152_COL'||r.rn,r.wd);
ELSE
APEX_UTIL.SET_SESSION_STATE('P152_COL'||r.rn,'-');
END IF;
END LOOP;
END;
Note that I assumed date format DD-MON-YYYY for the P152_START_DATE page item - adjust as needed for your project

How to format a 4 digit year as a date in DAX?

I pulled data into Power BI from a SQL query which returns only the order year in one of the columns. In Power BI I formatted the column as "Data type Date" and "Date time format 2001(yyyy)", but when I pull that column into a table in Power BI, it's clearly calculating 2020 and 2021 as the number of days from 1/1/1900 (like excel) because it shows the year as 1905 for both when inserting this column into a visual, instead of years 2020 and 2021.
How can I format this column as the year 2020 and 2021?
Thank you,
You can convert it in the data source, or you can add a custom column in Power Query with M, or a calculated column in the model with DAX. If your data is not too much, it doesn't really matter where you will do that, but the general recommendation is to do that as close to the data source as you can (i.e. if you can, add it to your query, or if you can't add a calculated column).
The data source option needs a column in your query, which can be added with expression like this (this one uses DATEFROMPARTS T-SQL command, if you are using another database, you will have to change it):
DATEFROMPARTS(ExistingYearOnlyColumn, 1, 1)
Or click Transform data to open Power Query Editor and click Add Column -> Custom Column:
and use #date to create the date:
The last option is to create a calculated column in DAX, by right-clicking on your table and selecting New column:
And use DATE DAX function in an expression like this:
DateColumn = DATE([ExistingYearOnlyColumn], 1, 1)

Power BI - Selecting and Filtering Columns based on Slicer Selection

Hello Stack Overflow Community,
In the attached excel sheet image, there are 5 columns (cols B to F) that have arbitrary sales numbers for years 2016-2020. In the report there will be a year slicer of each of these years. I want to calculate the total sales depending on the selection in the year slicer. However, there are 15 columns towards the end which dictate whether a particular company should be included in the total sales calculation. Only if the column corresponding to the selection by the user is N, the value should be included in the total sales calculation.
Example: If the user selects 2016,2017 and 2018 in the year slicer, Power BI should look into the column Excluded 2016-2017-2018 and include/ exclude the sales numbers of the respective years and finally return a table as below
Year Sales (Total)
2016 393
2017 561
2018 580
There is two problem in your case : the first is to be able to calcule with the filter and I think it will be easier if you do this in Excel and the second problem is to use a filter on a combinaison of imput to select only one value.
For the fist problem you could probably do something like that :
=IF(H2="Y";F2;0) / =IF(I2="Y";G2;0) / =IF(J2="Y";G2+F2;0)
and use the power of excel to slide the formula to the bottom of your table
And the next step is to sum the entire column and pivot the table :
But for the selection of the right row with your slicer on date i can't find a solution maybe you need to build a slider for all combinaison : 2016 / 2017 and 2016-2017,...

How to extract month name from date

I have colunm where date format DD/MM/YYYY I want to extract only month name like this MMM using power query and a calculated column
Example:
15/01/2021 becomes Jan
You can add a new column like below :
Month = Format([YourDate],”MMM”)
Or using a custom column :
= Table.AddColumn(#"Changed Type", "NewColumn", each DateTime.ToText([YourDate], "MMM"), type text)
Looks like you are quite new to PowerQuery, you can use the editor, or add the following to your M Script.
= Table.AddColumn(#"Renamed Columns2", "Custom", each Date.ToText([Date], "MMM"))
Add a custom column
open Power Query Editor -> click on Column from Examples -> Choose From Selection option
Select the date column from which you want to extract and then rename the new column as month.
Now, for example, if your first date in the date column is "15/01/2021" then type as jan and type the same in the second column as well as "jan" if the date is from the month of january then click on the screen. so all the values will become as "jan".
then you have to find a row which contains another month like "february" in your date column, then type "feb" and then click somewhere on the screen
you should get the result you wanted. :)
p.s. If this (or another) answer helps you, please take a moment to "accept" the answer that helped by clicking on the check mark beside the answer to toggle it from "greyed out" to "filled in".