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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.