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
Penn
Resolver I
Resolver I

Countrows last quarter in a matrix

Hi all,

 

I have a table with two text columns [Quarter] and [ID]. How I want to return the count of [ID] last quarter as below.

Annotation 2019-07-24 093359.jpg

 

Here are the calculations used in the matrix.

Measure: 

# of Opportunities = CALCULATE(COUNT(Opportunities[Id]))
 
Calculated Column:
Last Quarter = IF(VALUE(RIGHT(Opportunities[Quarter], 1)) = 1, VALUE(LEFT('Opportunities'[Quarter], 4) - 1) & " / Q4", LEFT('Opportunities'[Quarter], 😎 & VALUE(RIGHT('Opportunities'[Quarter], 1) - 1))
 
Measure: (Not Working)
Number of Opportunities Last Quarter = CALCULATE(COUNT('Opportunities'[Id]), FILTER('Opportunities', Opportunities[Quarter] = [Last Quarter]))
 Is there anyway to make this happen without using a date table? Thanks
 

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi Penn,

You could try to create a column like below(order quarter ace)

111.png

Then create a measure like beow

last q =
CALCULATE (
    COUNT ( 'LAST QUARTRE'[ID] ),
    FILTER (
        ALL ( 'LAST QUARTRE' ),
        'LAST QUARTRE'[Custom]
            = MIN ( 'LAST QUARTRE'[Custom] ) - 1
    )
)

112.png

Best Regards,

Zoe Zhi

 

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

3 REPLIES 3
Penn
Resolver I
Resolver I

I think I better build a date table then...problem solved

dax
Community Support
Community Support

Hi Penn,

You could try to create a column like below(order quarter ace)

111.png

Then create a measure like beow

last q =
CALCULATE (
    COUNT ( 'LAST QUARTRE'[ID] ),
    FILTER (
        ALL ( 'LAST QUARTRE' ),
        'LAST QUARTRE'[Custom]
            = MIN ( 'LAST QUARTRE'[Custom] ) - 1
    )
)

112.png

Best Regards,

Zoe Zhi

 

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

Good idea!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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