Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

2 what-if parameter connected using generateseries

Hello all,

I am trying to connect two parameters to each other. 

The first one is called "Day" as it contains day range from 1 to 31.

The second one is called "Index" and should be connected to the "Day" parameter with the following logic as shown in the screenshot. 

For example :

  • If the Day parameter is set on 15 which is higher than 9 (as in 9 June) then my range would start from -12 to -1 

  • If the Day parameter is set on 3 which is lower than 9 (as in 9 June) then my range would start from -13 to -2

Please find in attachment the pbix sample file. 

 

Can you help me solve it ? 

Many thanks.

Greg_Deckler  amitchandak Ashish_Mathur 

Abdoullah 

  • Hi Anonymous 
    Another way of doing that is as follows https://we.tl/t-rEUCEmyA59

    Index = 
    GENERATE (
        Parameter,
        VAR CurrntValue = Parameter[Parameter]
        VAR DayOfToday = DAY ( TODAY ( ) )
        VAR IndexStart = IF ( CurrntValue <= DayOfToday, -13, -12 )
        VAR IndexEnd = IF ( CurrntValue <= DayOfToday, -2, -1 )
        RETURN 
            GENERATESERIES ( IndexStart, IndexEnd, 1 )
    )

5 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Anonymous 
    Another way of doing that is as follows https://we.tl/t-rEUCEmyA59

    Index = 
    GENERATE (
        Parameter,
        VAR CurrntValue = Parameter[Parameter]
        VAR DayOfToday = DAY ( TODAY ( ) )
        VAR IndexStart = IF ( CurrntValue <= DayOfToday, -13, -12 )
        VAR IndexEnd = IF ( CurrntValue <= DayOfToday, -2, -1 )
        RETURN 
            GENERATESERIES ( IndexStart, IndexEnd, 1 )
    )
  • tamerj1's avatar
    tamerj1
    Community Champion

    Anonymous 

    Do you need to add this index as a column? Then how does the table look like?

    • Anonymous's avatar
      Anonymous
      Not applicable

      tamerj1 
      Not as a column but as slicer. 

      Will be linked later with a DIM_Calendar table based on the values. 

       

       

  • tamerj1's avatar
    tamerj1
    Community Champion

    Anonymous 

    Tables cannot read the filter context. Ot won't automatically update on selection