Forum Discussion

BI101's avatar
BI101
Regular Visitor
2 years ago
Solved

stacked column chart - graphing multiple years

Hi,

 

I'm looking to graph box count data by month versus a previous year.

My data goes back multiple years but only looking to go back 1 year. Any ideas on how to do this and the best graph to use? Right now i have the year selected for the legend but i'm not able to select the year, it simply graphs all data.

 

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi BI101 

    You can refer to the following sample.

    Sample data 

    Create a measure

     

    MEASURE =
    VAR a =
        MAXX ( ALLSELECTED ( 'Table' ), YEAR ( [Date] ) )
    VAR b = a - 1
    RETURN
        CALCULATE (
            COUNTROWS ( 'Table' ),
            OR ( YEAR ( 'Table'[Date] ) = a, YEAR ( 'Table'[Date] ) = b )
        )
    

     

    Then put the measure and related value to visual.

     

    Output

     

     

    Best Regards!

    Yolo Zhu

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

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi BI101 

    You can refer to the following sample.

    Sample data 

    Create a measure

     

    MEASURE =
    VAR a =
        MAXX ( ALLSELECTED ( 'Table' ), YEAR ( [Date] ) )
    VAR b = a - 1
    RETURN
        CALCULATE (
            COUNTROWS ( 'Table' ),
            OR ( YEAR ( 'Table'[Date] ) = a, YEAR ( 'Table'[Date] ) = b )
        )
    

     

    Then put the measure and related value to visual.

     

    Output

     

     

    Best Regards!

    Yolo Zhu

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