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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Compare the count of values from last year month to current year month for all month in Matrix

Hello,

 

 new to powe bi, i need to compare last year month count to presene year count, if value increase need to show arrow mark should be up, if decrease arrow should be down in conditional formatepbi community.png

 

when i use date date add, parallell period, privious month it will compare with in the year of month it won't give result last year month screen shot below

 

 

pmi community 2.png

 

pls help me sort out this issue

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Use a single slicer and create two measures like below:

current_year_month =
CALCULATE (
    COUNT ( 'table'[value] ),
    FILTER (
        ALLSELECTED ( 'table' ),
        'table'[plant] = SELECTEDVALUE ( 'table'[plant] )
            && YEAR ( 'table'[date] ) = YEAR ( SELECTEDVALUE ( 'table'[date] ) )
            && MONTH ( 'table'[date] ) = MONTH ( SELECTEDVALUE ( 'table'[date] ) )
    )
)

Last_year_month =
CALCULATE (
    COUNT ( 'table'[value] ),
    FILTER (
        ALLSELECTED ( 'table' ),
        'table'[plant] = SELECTEDVALUE ( 'table'[plant] )
            && YEAR ( 'table'[date] )
                = YEAR ( SELECTEDVALUE ( 'table'[date] ) ) - 1
            && MONTH ( 'table'[date] ) = MONTH ( SELECTEDVALUE ( 'table'[date] ) )
    )
)

 

Best Regards,

Jay 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Use a single slicer and create two measures like below:

current_year_month =
CALCULATE (
    COUNT ( 'table'[value] ),
    FILTER (
        ALLSELECTED ( 'table' ),
        'table'[plant] = SELECTEDVALUE ( 'table'[plant] )
            && YEAR ( 'table'[date] ) = YEAR ( SELECTEDVALUE ( 'table'[date] ) )
            && MONTH ( 'table'[date] ) = MONTH ( SELECTEDVALUE ( 'table'[date] ) )
    )
)

Last_year_month =
CALCULATE (
    COUNT ( 'table'[value] ),
    FILTER (
        ALLSELECTED ( 'table' ),
        'table'[plant] = SELECTEDVALUE ( 'table'[plant] )
            && YEAR ( 'table'[date] )
                = YEAR ( SELECTEDVALUE ( 'table'[date] ) ) - 1
            && MONTH ( 'table'[date] ) = MONTH ( SELECTEDVALUE ( 'table'[date] ) )
    )
)

 

Best Regards,

Jay 

tamerj1
Super User
Super User

Hi @Anonymous 

try with two slicers, one for the year and one for the month and avoid using hierarchy slicer 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.