Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BI101
Regular Visitor

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.

 

 

BI101_0-1709753154316.png

BI101_1-1709753182558.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @BI101 

You can refer to the following sample.

Sample data 

vxinruzhumsft_0-1709777958790.png

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.

vxinruzhumsft_1-1709778012282.png

 

Output

vxinruzhumsft_2-1709778024672.png

 

 

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.

 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @BI101 

You can refer to the following sample.

Sample data 

vxinruzhumsft_0-1709777958790.png

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.

vxinruzhumsft_1-1709778012282.png

 

Output

vxinruzhumsft_2-1709778024672.png

 

 

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.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors