Forum Discussion

pradeept's avatar
pradeept
Icon for Resolver I rankResolver I
5 years ago
Solved

Default Selection for Latest Period (Data for Latest Period)

Hi Community,   Need your help.   Sceanrio: I have 2 slicers in one page. Year (YYYY) and Month (YYYYMM).  1) When I open the the dashboard, the slicer has to  set for the latest Year and latest...
  • pradeept's avatar
    pradeept
    5 years ago

    Anonymous thanks for your help.

     

    I don't want to use the static dates;  the dates should be dynamic,  in measures calculation. 
    I tried to overcome the filtering at each visual as well.
     
    Finally got some solution, after tweaking my initial DAX measure. Here is the DAX measure calculation I used to achieve this.. 
     
    SalesAmount Latest Period=
    Var _MaxReportPeriod =
    CALCULATE(
    MAX(Sales[ReportingPeriod]),
    ALLEXCEPT(Sales,Sales[ReportingPeriod],Sales[ReportingYear])
    )

    RETURN
    CALCULATE(
    SUM(Sales[Amount]), Sales[ReportingPeriod] = _MaxReportPeriod
    )