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
Anonymous
Not applicable

Count of failures per year?

Hello Im new to DAX formulas, Im hoping someone can help me with my below task

 

I have imported data from an excel file that contained 3 work sheets named "2022", "2023" and "2024".

Each row in these work sheets represents a failure

 

I would like to create a summary table that shows the Total count of failures per year.

 

How do I state this in DAX? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 


Based in your needs, I have created the following tables:

vjialongymsft_0-1736905428316.png

vjialongymsft_1-1736905441024.png

vjialongymsft_2-1736905453641.png

 

Then please try the following dax to create a new table:

 

SummaryTable = 
SUMMARIZE(
    UNION(
        SELECTCOLUMNS('2022', "Year", 2022, "Failure", '2022'[Failure]),
        SELECTCOLUMNS('2023', "Year", 2023, "Failure", '2023'[Failure]),
        SELECTCOLUMNS('2024', "Year", 2024, "Failure", '2024'[Failure])
    ),
    [Year],
    "Total Failures", COUNTROWS(
        FILTER(
            UNION(
                SELECTCOLUMNS('2022', "Year", 2022, "Failure", '2022'[Failure]),
                SELECTCOLUMNS('2023', "Year", 2023, "Failure", '2023'[Failure]),
                SELECTCOLUMNS('2024', "Year", 2024, "Failure", '2024'[Failure])
            ),
            [Year] = EARLIER([Year])
        )
    )
)

 

 

Result:

vjialongymsft_3-1736905541095.png

 

 

 

 

 

Best Regards,

Jayleny

 

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
Anonymous
Not applicable

Hi @Anonymous 


Based in your needs, I have created the following tables:

vjialongymsft_0-1736905428316.png

vjialongymsft_1-1736905441024.png

vjialongymsft_2-1736905453641.png

 

Then please try the following dax to create a new table:

 

SummaryTable = 
SUMMARIZE(
    UNION(
        SELECTCOLUMNS('2022', "Year", 2022, "Failure", '2022'[Failure]),
        SELECTCOLUMNS('2023', "Year", 2023, "Failure", '2023'[Failure]),
        SELECTCOLUMNS('2024', "Year", 2024, "Failure", '2024'[Failure])
    ),
    [Year],
    "Total Failures", COUNTROWS(
        FILTER(
            UNION(
                SELECTCOLUMNS('2022', "Year", 2022, "Failure", '2022'[Failure]),
                SELECTCOLUMNS('2023', "Year", 2023, "Failure", '2023'[Failure]),
                SELECTCOLUMNS('2024', "Year", 2024, "Failure", '2024'[Failure])
            ),
            [Year] = EARLIER([Year])
        )
    )
)

 

 

Result:

vjialongymsft_3-1736905541095.png

 

 

 

 

 

Best Regards,

Jayleny

 

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

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

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.