Forum Discussion

Raman3456's avatar
Raman3456
Icon for Helper II rankHelper II
1 year ago
Solved

Selected Year and Previous Year

Hello Everyone,

 

I have 3 columns in my data: Finished year, Project cost, Project name.

My requirement is 

Finished year slicer --2021 I selected

The 

column chart should show the ----  2020,2021 in the x-axis with project cost as a Y Axis.

 

Please help me out with this issue.

 

Regards,

Ramana PC

 

  • Hi Raman3456 please try this

    you can create disconnected table year as this
    YearSelector =
    DISTINCT ( SELECTCOLUMNS ( 'Calendar', "Year", 'Calendar'[Year] ) )

     

    And measure as this Selected & Previous Year Cost =
    VAR SelectedYear = SELECTEDVALUE('YearSelector'[Year])
    RETURN
    IF (
    SELECTEDVALUE('Calendar'[Year]) IN {SelectedYear, SelectedYear - 1},
    [Total Project Cost measure]
    )

7 Replies

      • johnt75's avatar
        johnt75
        Icon for Super User rankSuper User

        Set up the 2 date tables as they do in the article / video, but when creating the calculation item instead of using 6 months use 12 instead.

        To create the relationship from date to your table, add a new calculated column as

        Finished Date = DATE( 'Table'[Finished Year], 1, 1)

        and then create a one-to-many single direction relationship from 'Date'[Date] to 'Table'[Finished Date].

        In the slicer, use the year column from the date table. On the chart use the year column from previous date.

  • Hi Raman3456 please try this

    you can create disconnected table year as this
    YearSelector =
    DISTINCT ( SELECTCOLUMNS ( 'Calendar', "Year", 'Calendar'[Year] ) )

     

    And measure as this Selected & Previous Year Cost =
    VAR SelectedYear = SELECTEDVALUE('YearSelector'[Year])
    RETURN
    IF (
    SELECTEDVALUE('Calendar'[Year]) IN {SelectedYear, SelectedYear - 1},
    [Total Project Cost measure]
    )

  • v-prasare's avatar
    v-prasare
    Icon for Community Support rankCommunity Support

    Hi Raman3456As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?

     

    johnt75&techies Thanks for your promt response.

     

     

    Thanks,

    Prashanth Are

    MS Fabric community support

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

  • v-prasare's avatar
    v-prasare
    Icon for Community Support rankCommunity Support

    Hi Raman3456,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?

     

     

     

     

    Thanks,

    Prashanth Are

    MS Fabric community support

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

  • v-prasare's avatar
    v-prasare
    Icon for Community Support rankCommunity Support

    Hi Raman3456,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?

     

     

     

     

    Thanks,

    Prashanth Are

    MS Fabric community support

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query