Show each month as a column in a table in PowerBI - datatable

I want to show in a table each month of ExaminationDate rather than just the year and month. For example, currently I have ExaminationDate in Field with Year and Month selected which shows:
Year Month
2021 January
2021 Febuary
2021 March
But how would I get it to display thusly:
Year January February March etc
2021 value
2021
2021

Related

Find all customers who engaged continuously for 6 months

I need code help in Oracle
I have table with the following structure. This is an aggregate table grouped by Account_ID and month (month rolled to the start date of the month) and number of transactions performed in that month.
Account_ID Date Trans_cnt
------------------------------
A00001 01Jan2018 12
A00002 01Jan2018 14
A00002 01Feb2018 01
A00003 01Feb2018 02
A00001 01Mar2018 12
I need to find accounts which have had continuous 6 months of transaction and 3 months of transactions
an example if account A00001 is analyzed for 6 months, then in a given year's time say from Jan 2018 to Dec 2018, this account should have continuous transactions from Jan to Jun or Feb to Jul; or Mar to Aug likewise.
Let me know how to come up with a sql for the same.

How to Convert ddmmyyyy to year(Date)?

I am new to OBIEE
I have date in ddmmyyyy format .
How can i create Year, Quarter, Month as separate fields out of that?
Example:
Order_date
21/11/2017
02/09/2016
OutPut
Year
2017
2016
Month
11
09
In OBIEE a time value (i.e. now()) evaluates to quarter of year as:
qarter_of_year(now())
to year as:
year(now())
to month as
month(now())
+1 to Christian - just use the actual OBI functions!
If it doesn't work you are probably not working with actual DATE data types but some numerical or varchar types.

Oracle SQL date getting first day of last quarter and last day of last quarter

I've been asked to provide an Oracle PL/SQL solution if a file is loaded into the system
for example between the dates of 1st Jan 2017 - 31st March 2017 I should
created two dates from the last quarter a loaded from date of
1st Oct 2016 and loaded to date of 31st Dec 2016. This should be future prove meaning it should work for future years, so if a file is loaded into the system lets say 21st August 2019, it should have a from date of 1st April 2019 and a to date of 30th June 2019.
This should be a PL/SQL solution most probably a procedure returning two dates to the main program and the to and from date returned should be in the format of DD/MM/YYYY.
Thanks in advance.
What about this solution?
SELECT
TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE, 'Q'), -3), 'DD/MM/YYYY') AS output_from_date,
TO_CHAR(TRUNC(SYSDATE, 'Q')-1, 'DD/MM/YYYY') AS output_to_date
FROM dual;
OUTPUT_FROM_DATE OUTPUT_TO_DATE
01/04/2017 30/06/2017

Last Sunday of March and October

I want to populate a table ---one column having the date for last Sunday of March and October for each year from 1800 to 2050 ..
Can someone help?
Thanks in advance
SELECT NEXT_DAY(LAST_DAY(SYSDATE)-7, 'SUN') FROM DUAL;
This gives the last date of the current month.
You just need to loop through the months instead of just giving SYSDATE.

Converting a Hebrew month name to an English month name in Oracle

I have to take user input in Hebrew (a month name) and convert it to an English month name. Is there any way to convert this (maybe using to_date and to_char) without a lookup table?
Update - following the suggestion for Norwegian I made this test, showing that the short Hebrew month names are longer than three characters! (I can only handle three character strings in this function)
with d as
(
select to_date('01' || lpad(rownum,2,'0') || '2011','DDMMYYYY') d from
(
select 1 from dual connect by level <=12
)
)
select to_char(d.d,'MON','NLS_DATE_LANGUAGE=HEBREW') heb_mon,
to_char(d.d,'MONTH','NLS_DATE_LANGUAGE=AMERICAN') us_mon
from d;
Which produced this data
ינואר JAN
פברואר FEB
מרץ MAR
אפריל APR
מאי MAY
יוני JUN
יולי JUL
אוגוסט AUG
ספטמבר SEP
אוקטובר OCT
נובמבר NOV
דצמבר DEC
Here's the first thing that came to my mind. I don't know enough hebrew to test with hebrew values, but this seems to work with norwegian:
with test_norwegian as (
select 'januar' month
from dual
)
select
to_char(
to_date('1 '||test_norwegian.month||' 2011', 'dd month yyyy', 'NLS_DATE_LANGUAGE=NORWEGIAN')
, 'month', 'NLS_DATE_LANGUAGE=NORWEGIAN') norwegian_month
,to_char(
to_date('1 '||test_norwegian.month||' 2011', 'dd month yyyy', 'NLS_DATE_LANGUAGE=NORWEGIAN')
, 'month', 'NLS_DATE_LANGUAGE=AMERICAN') american_month
from test_norwegian
Based on a quick scan of the Wikipedia Article: Hebrew calendar it seems reasonable to say that the Hebrew calendar does not operate the same way as the Gregorian calendar. Examples include:
There is no leap month in the Gregorian calendar for the year 5771.
Gregorian months are fixed length. Since they are based on lunar cycles, not all Hebrew months are fixed length.
If you want to convert between Hebrew and Gregorian month names, You will first need to convert from a Hebrew date to a Gregorian date then determine the Gregorian month.
A google search for "convert from hebrew date to gregorian date" produces what appears to be a large number of tools for converting between these calendars.
Here is an sourceforge project that may apply hebcal

Resources