Author Topic: Getting Month and its fytd populate in a prompt  (Read 192 times)

Offline cognos05

  • Statesman
  • ******
  • Join Date: Apr 2014
  • Posts: 620
  • Forum Citizenship: +1/-1
Getting Month and its fytd populate in a prompt
« on: 01 Dec 2019 08:20:55 pm »
Hi ,

I have a requirement to show May 2019 and May 2019 FYTD  , June 2019 and Jun 2019 FYTD etc in a prompt, so users can select either May 2019 or May 2019 FYTD .

May 2019 FYTD - is nothing but Jul 2018 to May 2019 months based on fiscal period.

My hierarchy in the transformer cube is like

FY 2019  Fiscal Year
July 2018  Fiscal Month
Aug 2018
Jun 2019

So now I have to do a periods to total on May 2019 to get months from jun 2018 to may 2019 . I have to generate the FYTD for each member .

How can i do a dynamic expression and feed to the prompt .

My output I expect is something like

Jul 2018
July 2018 FYTD
Aug 2018
Aug 2018 FYTD
etc..
Jun 2019
Jun 2019 FYTD


Thanks and any suggestions is appreciated.

Offline CognosPaul

  • Global Moderator
  • Statesman
  • *****
  • Join Date: Jan 2009
  • Posts: 1,852
  • Forum Citizenship: +265/-1
    • Paul's Cognos Blog
Re: Getting Month and its fytd populate in a prompt
« Reply #1 on: 01 Dec 2019 09:31:41 pm »
Can you get away with offering a YTD checkbox? Can you also describe your hierarchy in a little more detail?

Offline cognos05

  • Statesman
  • ******
  • Join Date: Apr 2014
  • Posts: 620
  • Forum Citizenship: +1/-1
Re: Getting Month and its fytd populate in a prompt
« Reply #2 on: 02 Dec 2019 08:35:51 am »
Attached the image of time hierarchy .

Yes I can check if check box is a good option , but would like to know if something getting these combined is possible.

Even if its hard coded for 2 years I think it will be okay to update once a year .

Offline CognosPaul

  • Global Moderator
  • Statesman
  • *****
  • Join Date: Jan 2009
  • Posts: 1,852
  • Forum Citizenship: +265/-1
    • Paul's Cognos Blog
Re: Getting Month and its fytd populate in a prompt
« Reply #3 on: 02 Dec 2019 08:56:53 am »
Since you're using PowerCubes you're not using DQM, which means you can't use the macro case statement.

If you CAN use a YTD checkbox, do the following


Create three data items.
Data Item NameExpression
Month Not YTD#prompt('Month','mun')#
Month YTDperiodsToDate([Cube].[Dim].[Hier].[YearLevel],#prompt('Month','mun')#)
Month#sb(promptmany('YTD','token','Month Not YTD'))#

Make a checkbox prompt with the parameter name "YTD". Static display value "YTD" use value "Month YTD"

In your data container use the Month data item. When the YTD checkbox is checked it will point to the Month YTD data item, otherwise it will point to the Month Not YTD data item.

This also assumes the user doesn't need to select multiple months.
« Last Edit: 02 Dec 2019 12:24:35 pm by CognosPaul »

Offline cognos05

  • Statesman
  • ******
  • Join Date: Apr 2014
  • Posts: 620
  • Forum Citizenship: +1/-1
Re: Getting Month and its fytd populate in a prompt
« Reply #4 on: 02 Dec 2019 11:54:24 am »
Hi Paul ,

Month YTD   periodsToDate([Cube].[Dim].[Hier].[YearLevel],#prompt('Month','mun')#)/td]


what is /td at the end of month ytd expression .

I am trying to understand what you have suggested.

so first I create a month prompt with month values in it . not the years just month , for example , i havce something like children ([2019]) which will list jul 2018 to jun 2019 .

Then I create 3 data items as you stated.

Then create a checkbox with static values on it having YTD as display and "Month YTD" as use value .

can you explain me the sequence on how this works.

Thanks for all your help .


Offline CognosPaul

  • Global Moderator
  • Statesman
  • *****
  • Join Date: Jan 2009
  • Posts: 1,852
  • Forum Citizenship: +265/-1
    • Paul's Cognos Blog
Re: Getting Month and its fytd populate in a prompt
« Reply #5 on: 02 Dec 2019 12:23:34 pm »
That /td] should not have been there, I removed it from the expression.

You should have two queries - one feeding your prompt and another for the report.

In the prompt query you can use something like children([2019]) or even just the month level.

In the report query you should have the three data items like I said.

The month data item should have

Code: [Select]
#sb(promptmany('YTD','token','Month Not YTD'))#
Another problem there - the parameter data type needs to be token, not mun. The sb wraps the returned value from the prompt function in square brackets. The prompt function defaults to Month Not YTD.

So if the checkbox isn't selected, the data item would look like:

[Month Not YTD]

but if the checkbox is selected the end result would be:
[Month YTD]

It's simply a complicated way of selecting the correct data item that you want. When the checkbox is selected the selected month will be wrapped in the periodsToDate function, whereas if the checkbox is not selected it will just return the month.

Offline cognos05

  • Statesman
  • ******
  • Join Date: Apr 2014
  • Posts: 620
  • Forum Citizenship: +1/-1
Re: Getting Month and its fytd populate in a prompt
« Reply #6 on: 03 Dec 2019 09:16:11 pm »
Hi Paul,

Thanks for your help,This is working fine , I have only one issue, so the autosubmit option is not there for checkbox group , so when I select a month and uncheck the box the values will not change until I choose another month.

Can we do anything to get this functionality.

Thanks,

Offline CognosPaul

  • Global Moderator
  • Statesman
  • *****
  • Join Date: Jan 2009
  • Posts: 1,852
  • Forum Citizenship: +265/-1
    • Paul's Cognos Blog
Re: Getting Month and its fytd populate in a prompt
« Reply #7 on: 03 Dec 2019 10:13:28 pm »
Instead of a checkbox, use a radio prompt that has

DisplayUse
YTDMonth YTD
Not YTDMonth Not YTD


It is possible to write JS that will set up the autosubmit, but let's try this first.

 


       
Twittear