Forum Discussion

JothiG's avatar
JothiG
Helper III
11 months ago
Solved

Dax requirement

here, i have year and month slicer and other more slicer. my requirement is, if i didn't select year and month slicer above age wise stacked area chart should show the max year and max month va...
  • MohamedFowzan1's avatar
    11 months ago

    Hi JothiG 

     

    For this you would have to use a measure for Year & Month as well and then calculate the value dynamically.

    SelectedYear =
    IF(
        ISBLANK(SELECTEDVALUE('Table'[stock_year])),
        CALCULATE(MAX('Table'[stock_year]), ALL('Table')),
        SELECTEDVALUE('Table'[stock_year])
    )


     

    SelectedMonth =
    IF(
        ISBLANK(SELECTEDVALUE('Table'[stock_month])),
        CALCULATE(MAX('Table'[stock_month]), FILTER('Table', 'Table'[stock_year] = [SelectedYear])),
        SELECTEDVALUE('Table'[stock_month])
    )

     

    CALCULATE(
        [Value],
        'Table'[stock_year] = [SelectedYear],
        'Table'[stock_month] = [SelectedMonth]
    )

     
    Please use the corresponding table names