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! Learn more

Reply
Anonymous
Not applicable

Adding year to the formula calculation

Hi, 

 

I have a formula which is mentioned below:

 

Total Number of Class A = CALCULATE(COUNTROWS('SHOP Final Assy-Casework'), FILTER(ALL('SHOP Final Assy-Casework'), 'SHOP Final Assy-Casework'[Class Level] = "Class A"),FILTER(ALL('SHOP Final Assy-Casework'),'SHOP Final Assy-Casework'[Month]=MAX('SHOP Final Assy-Casework'[Month])))

 

but, however, it doesn't add the count year-wise. In other, it is only taking 2017 values not the 2018 one's. Please let me know what should I add to calculate per year-wise.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Anonymous,

 

How about below formula, you can try it if it works for your scenario:

Total Number of Class A =
CALCULATE (
    COUNTROWS ( 'SHOP Final Assy-Casework' ),
    FILTER (
        ALLSELECTED ( 'SHOP Final Assy-Casework' ),
        'SHOP Final Assy-Casework'[Class Level] = "Class A"
    ),
    VALUES ( 'SHOP Final Assy-Casework'[Year] ),
    VALUES ( 'SHOP Final Assy-Casework'[Month] )
)

If not help, please share some sample data for test and coding formula.

 

Regards,

Xiaoxin Sheng

View solution in original post

Anonymous
Not applicable

Hi @Anonymous,

 

If you mean you wanted to calculate cumulative total, you can take a look at following blog:

Cumulative Total

 

In addition, you can remove 'class level' filter condition to get total count of specific records:

Total Number of Class A =
CALCULATE (
    COUNTROWS ( 'SHOP Final Assy-Casework' ),
        ALLSELECTED ( 'SHOP Final Assy-Casework' ),
    VALUES ( 'SHOP Final Assy-Casework'[Year] ),
    VALUES ( 'SHOP Final Assy-Casework'[Month] )
)

 

Regards,

Xiaoxin Sheng

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @Anonymous,

 

How about below formula, you can try it if it works for your scenario:

Total Number of Class A =
CALCULATE (
    COUNTROWS ( 'SHOP Final Assy-Casework' ),
    FILTER (
        ALLSELECTED ( 'SHOP Final Assy-Casework' ),
        'SHOP Final Assy-Casework'[Class Level] = "Class A"
    ),
    VALUES ( 'SHOP Final Assy-Casework'[Year] ),
    VALUES ( 'SHOP Final Assy-Casework'[Month] )
)

If not help, please share some sample data for test and coding formula.

 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Thank you for your help!. Alos, I wanted to know how can I calculate total submissions month wise and filtering it by year for the same sort of count which I asked before. Thank you. It would be helpful

Anonymous
Not applicable

Hi @Anonymous,

 

If you mean you wanted to calculate cumulative total, you can take a look at following blog:

Cumulative Total

 

In addition, you can remove 'class level' filter condition to get total count of specific records:

Total Number of Class A =
CALCULATE (
    COUNTROWS ( 'SHOP Final Assy-Casework' ),
        ALLSELECTED ( 'SHOP Final Assy-Casework' ),
    VALUES ( 'SHOP Final Assy-Casework'[Year] ),
    VALUES ( 'SHOP Final Assy-Casework'[Month] )
)

 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Thank you @Anonymous 🙂

Anonymous
Not applicable

@Anonymous

Anonymous
Not applicable

Yes, thank you. It worked. It would be helpful if you could suggest me where can I learn DAX language. I mean for power BI. Thanks.

Ashish_Mathur
Super User
Super User

Hi,

 

Share some data, describe the business question and show the expected result.


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

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