Forum Discussion

ATYB9's avatar
ATYB9
New Member
3 years ago
Solved

Data slicing - multiple years

Hello,   I am fairly new to Power BI and I am trying to use slicer to apply in a dynamic way so that the visuals on the same page show the relevant data for the particular year.   See below my da...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi ATYB9 ,

    I updated your sample pbix file, please find the detailed steps in the attachment.

    1. Unpivot Heading1~Heading5 columns of the query 'Merge1'

    2. Create a period dimension table(Don't create any relationship with Merge1 table)

    3. Update the formula of measure [SelectedYear] as below

    SelectedYear = SELECTEDVALUE('Period Ends'[Period End])

    4. Create two measures to get the selected year and previous year heading values

    CY_Headings =
    CALCULATE (
        SUM ( 'Merge1'[Value] ),
        FILTER ( 'Merge1', 'Merge1'[Period End] = [SelectedYear] )
    )
    PY_Headings = 
    CALCULATE (
        SUM ( 'Merge1'[Value] ),
        FILTER ( 'Merge1', 'Merge1'[Period End] = [PriorYearToSelectedYear] )
    )

    PS: After you open the attachment, please update the data source file directory with yours for the query "Summary details" and "Draft position"...

    Best Regards