Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to form parameter expression string to always default to current year
    primarykey
    data
    text
    <p>I have an expression string that is pulling in the year from SSAS using a dimension for year and calendar month. I want to modify this so that it automatically defaults to the current year. </p> <p><img src="https://i.stack.imgur.com/5pnFw.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/ziaO9.png" alt="enter image description here"></p> <pre><code>[Allegation Closed Date].[Year].&amp;[2013] </code></pre> <p>A harder example of this but pretty much the same thing, is where I want to default to current year but use a pre-set month. In the example below it would always be the 1st month of the current year but can be set to any month. The problem I am having is that I cant just default to a current year because this information is being pulled from a table field. </p> <p><code>[Allegation Closed Date].[Calendar Month].&amp;[2013-01]</code></p> <p>I was thinking I could just do something like this and it would work:</p> <p><code>[Allegation Closed Date].[Year].&amp;[Year(Now())]</code></p> <p>I tried a couple different variations on the string above and none of them worked. I have also tried creating a calculated field in the dataset called currentyear and then calling this field with:</p> <p><code>[Allegation Closed Date].[Year].&amp;[CurrentYear]</code></p> <p>Tried the method below and that did not work so I thought I could redesign the query to filter out all years greater than current year. Here is a screenshot of the query designer.</p> <p><img src="https://i.stack.imgur.com/GOeR0.png" alt="enter image description here"></p> <p>The query is a little hard to read, it is:</p> <p><code>WITH MEMBER [Measures].[ParameterCaption] AS [Allegation Closed Date].[Year].CURRENTMEMBER.MEMBER_CAPTION MEMBER [Measures].[ParameterValue] AS [Allegation Closed Date].[Year].CURRENTMEMBER.UNIQUENAME MEMBER [Measures].[ParameterLevel] AS [Allegation Closed Date].[Year].CURRENTMEMBER.LEVEL.ORDINAL SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , [Allegation Closed Date].[Year].ALLMEMBERS ON ROWS FROM ( SELECT ( { [Allegation Status].[Allegation Status].&amp;[Closed] } ) ON COLUMNS FROM [Allegation Analysis])</code> </p> <p>So I figured out what to enter so it would default to current year and it is:</p> <pre><code>="[Allegation Closed Date].[Year].&amp;["+CSTR(Year(Today))+"]" </code></pre> <p>Still have to figure out what to enter for month but at least I know I am on the right track.</p> <p>Any help is greatly appreciated still on how to format to be year-month.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload