Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Dynamic measure/indicator based on selected date

Hi all, I would like to create a dynamic measure/indicator depending on a date, a simplified version of my problem is as follows:

 

The PortfolioOverview table contains the four columns below (with possible null values for the final two columns):

 

ProductStatusIntro DateExit Date
ACurrent Stock  
BCurrent Stock 1-Oct
CTo be introduced1-Sep1-Oct
DTo be introduced1-Oct 

 

I have created a separate Date table, from which I want to be able to select any date in the future. Based on this selected date, I want a measure, say inPortfolio, that indicates whether or not my Product is in my portfolio on the selected date:

- it indicates a '0' if the product is 'current stock' that remains in stock

- it indicates a '1' if the product is 'to be introduced' and the selected date has passed its intro date without passing a possible exit date

- it indicates a '-1' if my product has passed its exit date (for both current stock as well as future introductions)

 

Example: selecting Nov-1 as a date should result in the following:

 

ProductStatusIntro DateExit DateinPortfolio
ACurrent Stock  0
BCurrent Stock 1-Oct-1
CTo be introduced1-Sep1-Oct-1
DTo be introduced1-Oct 1

 

I am able to create a Date table but I have difficulties with the 'inPortfolio' measure, any ideas how to achieve this?

Thank you in advance!

  • Anonymous , Try a measure like

     


    Switch(true() ,
    isblank(max([Intro Date])) && isblank(max([Exit Date])) , 0
    isblank(max([Exit Date])) && max([Intro Date]) < selectedvalue(Date[Date]), 0
    max([Exit Date]) < selectedvalue(Date[Date]) && max([Intro Date]) < selectedvalue(Date[Date]), -,
    blank()
    )

1 Reply

  • Anonymous , Try a measure like

     


    Switch(true() ,
    isblank(max([Intro Date])) && isblank(max([Exit Date])) , 0
    isblank(max([Exit Date])) && max([Intro Date]) < selectedvalue(Date[Date]), 0
    max([Exit Date]) < selectedvalue(Date[Date]) && max([Intro Date]) < selectedvalue(Date[Date]), -,
    blank()
    )