Forum Discussion

janinw's avatar
janinw
Icon for Helper I rankHelper I
6 years ago
Solved

Get date from page filter

Hi all,

 

I am building a dashboard in which I have a date/CW/month/quarter/year hierarchy. The consumer can set a filter and the dashboard will then display the results for the specified time frame.

 

Now I would like to implement a measure (daily target * # days) that displays the target for the set filter.

 

Is there a way to get the min and max date from the filter so I can can calculate the target for the specified time frame?

 

Many thanks,

Janine

 

 

 

 

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi janinw ,

     

    Use below DAX to get this done,

    Max_Date = CALCULATE(MAX('Date'[Date]),ALLSELECTED('Date'))
    Min_Date = CALCULATE(MIN('Date'[Date]),ALLSELECTED('Date'))
    Target = DATEDIFF(Min_Date,Max_Date,Day)*daily Target

    Find the below screenshot FYR..

    For October Month:
    Oct Month ->Week 41:
    Oct Month-> Week 43:
     
    Best Regards,
    @Mail2inba4

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • janinw you can use min and max function to get older and recent date and then use datediff to calculate # of days to multiply with the target.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi janinw ,

     

    Use below DAX to get this done,

    Max_Date = CALCULATE(MAX('Date'[Date]),ALLSELECTED('Date'))
    Min_Date = CALCULATE(MIN('Date'[Date]),ALLSELECTED('Date'))
    Target = DATEDIFF(Min_Date,Max_Date,Day)*daily Target

    Find the below screenshot FYR..

    For October Month:
    Oct Month ->Week 41:
    Oct Month-> Week 43:
     
    Best Regards,
    @Mail2inba4

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.