Pivot to display age span

Hi!
I have a task to create a pivot table but i am not familiar on how this works.
My customer wants to have a pivottable that contains countries in a row and ages and gender in the columns.
The query would output something like this.
Country Male Female 0-1 1-2 2-3 3+
Bolivia    1     2         2      0   0     1
Kenya     2    0          0     1           1
I have a table with countries, that i join to another table with children, in the child table the date of birth field exists.
Perhaps this is better to do without a pivot and calculate and insert data to a temporary table and then output it using select.
Any hint on how to do this is greatly appreciated.
Regards
Martin

For your case I suggest CASE based pivot, e.g.
select C.Country,
count(case when B.Gender = 'Male' then 1 end) as Male,
count(case when B.Gender = 'Female' then 1 end) as Female,
count(case when datediff(day, B.DOB, CURRENT_TIMESTAMP) <=365 then 1 end) as [0-1],
count(case when datediff(day, B.DOB, CURRENT_TIMESTAMP) BETWEEN 366 AND 730 then 1 END) as [1-2], etc. 
FROM dbo.Countries C LEFT JOIN dbo.BioInfo B ON C.CountryID = B.CountryID
GROUP BY C.CountryID
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles

Similar Messages

  • How to display "age of employee"?

    Hi,
    Can you pls tell me the procedure to display "age of employee" in IT 0002?
    I appreciate your helping nature.
    Thanks
    Yogi

    Hi Yugendar,
    Get the Date of Birth (GBDAT) from Infotype 0002 and use Sy-Datum field and mention condition like this
    wa_final-age = Gbdat-sydatym.
                         or
    use this FM
          data : months like vtbbewe-atage,
                 years  like vtbbewe-atage,
                 days  like vtbbewe-atage.
          clear : days, years, months.
          call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
            exporting
              i_date_from    = t_pa0001-doj
              i_date_to      = sy-datum
              i_flg_separate = 'X'
            importing
              e_days         = days
              e_months       = months
              e_years        = years.
          if days gt '15'.
            months = months + 1.
          endif.

  • External LCD Display & Screen Spanning

    Hi All
    I need to connect an external LCD display to my iMac G5 1st Gen computer.
    Is this the right cable -
    http://store.apple.com/Apple/WebObjects/ukstore.woa/wa/RSLID?mco=6C04E099&nplm=M 8639
    Also I have been reading in this forum about a screen spanning hack to the firmware. Sounds painful but what are practical steps to set this up?
    Many thanks in advance
    David

    G'day mate
    Thanks for the reply from Oz.
    Just had another good look at the back of the external LCD and it has got both VGA and DVI ports on it. Which will get the best results do you think?
    Also here is a dump re the graphics card in my iMac -
    GeForce FX 5200:
    Chipset Model: GeForce FX 5200
    Type: Display
    Bus: AGP
    Slot: AGP
    VRAM (Total): 64 MB
    Vendor: nVIDIA (0x10de)
    Device ID: 0x0329
    Revision ID: 0x00b1
    ROM Revision: 2103
    Displays:
    iMac:
    Display Type: LCD
    Resolution: 1440 x 900
    Depth: 32-bit Color
    Built-In: Yes
    Core Image: Supported
    Main Display: Yes
    Mirror: Off
    Online: Yes
    Quartz Extreme: Supported
    Display:
    Status: No display connected
    As you can see, the card is a GeForce FX 5200. The web site refers to iMac G5's with GeForce FX 5200 Ultra cards and not the GeForce FX 5200. (My iMac is a Rev A machine).
    Do you think this will cause issues? I need to run the iMac and the LCD at a show for my company and I am a bit concerned that I might end up with a Mac with no working display. Is that likely?
    Cheers
    David

  • Why does Birthday without Year in iContacts Display Age in iCalendar?

    I enter Birthdays - without year - in iCloud contacts. Then PC's (Windows 7) iCloud calendar displays "Jane Doe's 5th"  or "Jane Doe's 11th" birthday. Huh? How/Why does this happen and how can it be eliminated?

    Thanks, but inconsistencies with the reply.
    1. Started using iCloud contacts and calendar only in last two months so only entered contacts then too.
    2. Started with Outlook 2010 in August 2011.
    3. Why would it show ANY age with such new data?
    Would appreciate additional ideas please.

  • Pivot view display

    in the pivot view  i have a requirement where the country name should be displayed for each row
    rows                                                   measures
                                                                        sales
    country      states
    current output:
    india        MP                             10
                   AP                              20
                   HP                               30
                   Karnataka                     40
    US           TX                                50
                    NY                               60
    Required output:
    india                MP                             10
    india                AP                              20
    india                HP                               30
    india                Karnataka                     40
    US                 TX                                50
    US                 NY                               60
    can anyone tell me how to achieve this?

    Hi,
    Yes you can make that type,
    Go to Criteria and the analysis right side pane, and select the column which you want to show like that edit the column properties.
    Column Properties--> second tab column format --> there will be two options suppress and repeat, use Repeat (Check in ) then you will get that format.
    http://mkashu.blogspot.com
    Regards,
    VG

  • Display age in iCal using Address Book birthday

    Is there a hidden feature in iCal (or Address Book), or a plug-in available, that will let me display a person's age in iCal alongside their birthday using the date from Address Book?

    Hi Jenny,
    Dates To iCal 2 does this. It works under Leopard, but not Tiger.
    Dates to iCal 2 - A replacement for Apple's birthday calendar for iCal in Leopard.
    http://www.nhoj.co.uk/datestoical/
    As well as automatically syncing birthday dates from Address Book, Dates to iCal 2 can sync anniversary and custom dates. It can set up to five alarms for each date in iCal and can also set different alarms for birthdays and anniversaries. It allows the option of only syncing from one Address Book group. This application also allows for the titles of the events sent to iCal to be modified to the user's preference.
    Dates to iCal is shareware.
    Best wishes
    John Maisey
    As I sell software on my site and ask for donations, the Apple Discussions Use Agreement requres that I state that I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • Ap --Invoice Aging Report    aging period 0-360 periods

    we need to increase the aging report by 0-360 here i am diving like
    0-30 31-60 61-90 91-120 121-150 151-180 181-210 211-240 241-270 271-300 301-330 331-360
    The standard layout prints only 4 periods , we want to print all the above periods in output.
    1st i have created one test aging period.
    0-30 31-60 61-90 91-120 121-150 151-180 for testing i created this aging period and once i run **the standard report its displaying upto 61-90 the rest are not printing.**
    because standard report layout has only four periods. are those periods won't be incremented by our AGING PERIODS given in priod given.
    what i have to do for this. does the report will not print automatically the period given.
    how to print my given aging period 0 -150 .
    if the standard one report i need customize then what are the process steps in report builder and how to add extra aging period to standard layout.
    Please provide the usefull links for all
    suggestions are greate help
    thanks
    koteshwar

    Hi Koteshwar,
    the report will not display aging periods beyond 4 buckets which is the intended functionality as per
    below oracle reference:
    System Should Allow More Then Four Bucket in Invoice Aging Report [ID 1298644.1]
    However, you are create your own report or make a copy of this report and perform modification. For performing this activity, you need a dedicated report developer .............
    Regards,
    Ivruksha

  • TV as external display?

    I'm a sound editor for picture, and I would like to be able to play back QuickTime movies on a TV screen.
    I would like to set up a regular old tube TV with RCA or S-video input as an external display for my MacBook Pro. I would ALSO like to run an external Cinema Display at the same time. Is this possible?
    I think a cable like this would work, but would my Mac recognize the 2 separate external displays?
    http://www.mountsandmore.com/Comprehensive-ADA-DVI-2-DVIRGBHV-CH1604.html

    With that cable your only option would be to mirror, i.e. have the same display on the internal and both external displays, with the resolution on all 3 limited to the lowest one (the TV).
    To output to two separate external displays and span the desktop across them all, you need additional hardware (such as the Matrox TripleHead2Go, and then you'd need an adapter to convert the DVI/VGA to RCA or s-video.
    (A minor point, the linked cable text states "DVI female connector along with 3 female BNC connectors" but the image shows RCA connectors; I'd seek another vendor, just my 2¢).

  • Hyperion Interactive reporting - Pivot Section Facts Sequence / Order

    Requirement :
    Dynamically populating Month Name & Year as Column Name.
    Challenges :
    Using a computed colum and variable, we are able to assign the variable to the computed column and get the values as desired. We have 7 non computed columns and 12 computed columns to be displayed in the Pivot Section.
    All the functionalities are met except for displaying the 4 non computed columns first , the 12 computed columns secondly and remaining 3 non computed columns at the right end
    For Instance :
    The Pivot should display this.....
    Order Date Qty Amount Mar,10 Apr, 10........Feb, 11 Return Date Stock
    Instead, it is displaying as
    Order Date Qty Amount Return Date Stock Mar,10 Apr, 10........Feb, 11
    In the above scenario, my database columns are
    Order Date, Qty, Amount, Return Date, Stock
    and
    Computed Columns are :
    Mar,10 , Apr, 10........Feb, 11

    Is there a possibility to display Pivot Facts in a sequence order (computed & non computed items dynamically)?

  • HT5918 Display Port Monitors with MacPro 2013

    As of now, I am using 5 monitors on my MP 2006 and intend to move on to the new MP 2013.
    After reading this note ( http://support.apple.com/kb/HT6008 ) I have some questions.
    This article states that we can connect up to 6 monitors with mini-display port , and various restrictions on DVI and HDMI ones. However, it does not mention Display Port models, that can be connected via a Display / Mini Display port adapter.
    My first question is then to know wether I can connect up to 5 ( or 6 ) of such monitors at the same time  ( with DP to Mini DP adapters ) ?
    My second would be to know wether I can connect 2 monitors with DVI to Mini DP adapters and 2/3 monitors with Display to Mini DP adapters at the same time ?
    Finally, as there are no mentions of limits to VGA monitors used with VGA to Mini DP adapters : does that mean that I can use 5/6 monitors at teh same time that way ?
    Thank's for your help in getting answers, as I need to be sure of what works before upgrading my old workhorse ... :+))

    1.
    we can connect up to 6 monitors with mini-display port ... it does not mention Display Port models, that can be connected via a Display / Mini Display port adapter.
    DisplayPort is electrically the same as Mini DisplayPort. The adapter is simply a re-assignment of the pins to the different connectors. Some users find this adaptation is better performed with an adapter-cable, rather than a discrete adapter. Rules that apply to Mini DisplayPort stand exactly the same as (full size) DisplayPort.
    2.
    connect 2 monitors with DVI to Mini DP adapters AND 2/3 monitors with Display to Mini DP adapters at the same time ?
    These appear to be limited to 2 Single-Link DVI adapters unless you use USB-powered ACTIVE adapters. This setup is complicated, and that is not "The Apple way". it may suddenly require ALL adapters be ACTIVE adapters.
    3.
    VGA to Mini DP adapters : does that mean that I can use 5/6 monitors at the same time that way ?
    No. These will also be limited to easy use with the two display adapters. In today's digital display age, VGA is not a solution to anything. It is grudgingly provided to run your old projector.
    All VGA Adapters are ACTIVE -- they contain a chip that generates the Analog signal from the DisplayPort signal provided, and the VGA signal degenerates further in the process, and has limited resolution. There are no VGA Adapters which have the extra USB input, so that alone may limit you to the two specified.
    4.
    For completeness, keep in mind that a 4K display can use up to 14G bits/second (variable depending on how much is changing on screen) for a moving picture, so there may not be as much as expected left over on that 20G bits/sec ThunderBolt channel (2 ports/channel) to run your Drives.

  • 17" Display slightly yellow?

    I recently purchased a Macbook pro, and I've been using it for several weeks, and today I went back to my old computer, hooked up to the clear 17" Studio Display, and I was sort of shocked by how yellow it looked. I had a look at the calibration settings, but everything looked ok.
    Is it just that the Macbook Pro has a much whiter screen in comparison to the LCD or the Studio Display, or could it be the room light acting on them differently (I did move the computer with the display into a different room)?
    Another option, could the Studio Display age and yellow over time somehow?

    Good info.
    That model monitor has only ADC connectivity. You must be using some form of adaptor? If so, can you provide its details? Does it use the DVI or the s-video ports?
    I'm not an expert on ADC but I know it carried video, power, and USB lines concurrently. If your adaptor is not fully emulating the ADC connector functions on an Apple desktop machine with ADC, it could prevent the computer from properly identifying the monitor and offering you the proper options.
    Apple recommends this adaptor:
    http://store.apple.com/us/product/M8661LL/B?fnode=MTY1NDA5OQ&mco=MjE0NTg4NA
    Note it has an extra line and brings its own power supply to the party.
    I hope someone with more ADC experience that I can suggest what adaptors work best in your situation, Lacking that, you may have to look for another monitor that does not rely on ADC.

  • [Help] Span or mirror? 15" 1GHz

    Hi gurus,
    I've roughly gone thru related threads on my question but can't really find an answer.
    I have an 1GHz iMac G4.
    And I've recently gotten a 32" lcd tv (samsung LA32R81B) with pc in. (VGA).
    I plan to connect my mac to it for viewing of dvds.
    Since the iMac have VGA out,I've bought a VGA display adaptor.
    Question is.
    should I be mirroring the imac's display or spanning it?
    My tv's resolution is 1366 * 768.
    I understand that there are a few apps regarding external display situation. them being.
    SwitchResX
    Screen spanning Doc
    DisplayConfigX
    which shld I be using to fully optimise the display?
    Thanks in advance!!

    If you're just looking to play a DVD then mirroring is all that you need to do. Just change the settings on the TV so that 1024x768 is expanded to full screen. 
    mrtotes

  • Pivot Table with Dynamic Columns and Headers

    Hello,
    I'm trying to pivot a table of data where the column headers will be dynamic.  While I know how to pivot the table to get what I want how will I be able to pick up the table column header from the Pivot to display in the report?
    For example:
    Unpivoted data is Employee Code, Branch Code, Problem Code, # of Problems.
    There is many records for a given Employee and Branch that I want to pivot so the Column headers are the Problem Codes and the data below is the SUM(num_problems) for that Problem.
    So the data may look like this for Tech Bob, Branch NY.
    Problem = LEAK, Num_problem = 5
    Problem = DAMAGE, Num_problem = 2
    Problem = OTHER, Num_problem = 3
    Which problem codes may appear is unknown but selecting the DISTINCT(problem) across all techs gives me the column headings to use.
    So if I pivot this data, I get this Row:
    Tech = Bob, Branch = NY, DAMAGE = 2, LEAK = 5, OTHER = 3
    So first can SSRS handle having dynamic columns?  Only Tech and Branch are known and the remaining columns are dynamic based on how many Problems they worked on.
    Second, how can I set the column heading in my Tablix to be the Problem Code?
    Sherry

    You just need to use a  matrix container
    Use EmployeeCode and BranchCode for row group
    ProblemCode as column group and SUM([No Of Problems]) as the data expression and it will generate the columns for you based on ProblemCode values automatically.
    See an example here
    Sample Matrix
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Aligning Headings in Pivot View in one line

    Hi,
    I have a situation where Pivot View is displaying results as below
    H4--H5--H6
    H1--H2-H3
    A B C D E F
    I know this is how pivot view display results but user has asked me to align heading like this
    H1--H2-H3 H4--H5--H6
    A B C D E F
    I have tried various options but could not do much. Any idea if this is possible at all in Pivot View?
    Note: Actually this is a complex report where columns are coming from UNION of two queries. Table view is out of question because in that case rows get repeated. So all in all report output can be achieved by Pivot Table but user want to see report in tabular fashion.

    956681 wrote:
    Hi,
    I have a situation where Pivot View is displaying results as below
    H4--H5--H6
    H1--H2-H3
    A B C D E F
    I know this is how pivot view display results but user has asked me to align heading like this
    H1--H2-H3 H4--H5--H6
    A B C D E F
    I have tried various options but could not do much. Any idea if this is possible at all in Pivot View?
    Note: Actually this is a complex report where columns are coming from UNION of two queries. Table view is out of question because in that case rows get repeated. So all in all report output can be achieved by Pivot Table but user want to see report in tabular fashion.I'm not sure I get it. If your results are from a union of two queries, shouldn't your display be something like this?
    H1--H2--H3 H4--H5--H6
    A B C
    D E F
    (BTW, to see what I'm saying, you're going to have to click on "Reply" and then click on the "double quotes" to get the formatting I'm trying to illustrate. It doesn't look right when seen from the intial display.)

  • Customer Ageing - by posting period

    Hi All / Expert,
    I'm facing the customer ageing which I want to display by posting date (parameter in selection criteria) but the total not accruate. The total ageing already reconciled with payment (amount minus payment = remaining balance).
    Scenario
    1. Display ageing for as at 31.3.2008
    Ageing date  :31.03.2008
    Posting date :1.1.2008 to 31.3.2008
    Total ageing  :RM 100,000.00
    2. Payment on 5.4.2008 is RM 50,000.00
    3. 1. Display ageing for as at 31.3.2008
    Ageing date  :31.03.2008
    Posting date :1.1.2008 to 31.3.2008
    Total ageing  :RM 50,000.00 *
    In accounting normal practise it should be display
      RM 100,000.00 not RM 50,000.
    I dont know what programming or system logic how this customer ageing work.I guess the default by system date not by posting date.
    Anyone can tell me how customer ageing calculate the total ageing? Please help me, my client always blame me for this issue. I'm very appreaciated your help.
    Thanks in advance.
    uddin

    Good day,
    If I may guess, your customer runs SBO 2005? The ageing is wrong in 2005, but corrected in 2007, although there are other Statement issues in 2007.
    What should happen:
    Customer owns R1000 in 30 days but pays R500. Now he owns R500 in 30 days. 2007 is correct, but in 2005 the system takes the R500 off the current period (period in which payment was made), but not againt the 30 days.
    That's the reason why the ageing in 2005 is wrong.
    I hope this explains te situation to you.
    As soon as ou upgrade to 2007, the issue will be resolved. there are still other issues, but ... we deal with it.
    I hope it helps.
    Regards

Maybe you are looking for