Forum Discussion

rmcgrath's avatar
rmcgrath
Advocate II
1 year ago
Solved

X-Axis format

I have the following line chart where the X-Axis is controlled by a Parameter (Age or Weeks).  What I would like to happen is if Weeks is selected, then it displays 1 full year (depending on which ye...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi rmcgrath ,

     

    Try the following expression:

    FilteredWeeks = 
    VAR SelectedYear = SELECTEDVALUE('Year'[Year])
    VAR SelectedParameter = SELECTEDVALUE('Parameter'[Parameter])
    RETURN
    IF(
        SelectedParameter = "Weeks",
        CALCULATE(
            SUM('YourTable'[Value]), 
            FILTER(
                'YourTable', 
                YEAR('YourTable'[Date]) = SelectedYear
            )
        ),
        SUM('YourTable'[Value])
    )

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

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