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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Chockers1
Frequent Visitor

Running Total

Hi ALl,

 

I have created the below DAX which calucaltes the running averages for "Bat Inns" which is everytime a batter has batted in my database, this is set as a column.

 

Bat_RunningTotal_Bat_Innings_Col =
SUMX(
    FILTER(
        ALL(Bat),
        Bat[Player ID] = EARLIER(Bat[Player ID]) && Bat[Start Date] <= EARLIER(Bat[Start Date])
    ),
    IF(ISBLANK(Bat[Bat Inns]), 0, 1)
)

 

It works great!

 

The issue is when it's in a table on a dashboard it doesn't up it as a sequnce - eg, 1, 2, 3, 4 etc... It gets show by "Start Date" in which they may have batted twice.

 

in a matrix table it doesnt show each individual "Inns" if the batter batted twice in a match, anyone know how to fix it?is2.png

 

?

 

is.png

2 REPLIES 2
Anonymous
Not applicable

Hi @Chockers1 ,

Assuming you have a column [match id] in your Bat table that uniquely identifies each match, please try:

Bat_RunningTotal_Bat_Innings_Col =
SUMX (
    FILTER (
        ALL ( Bat ),
        Bat[Player ID] = EARLIER ( Bat[Player ID] )
            && Bat[Start Date] <= EARLIER ( Bat[Start Date] )
            && (
                Bat[Start Date] < EARLIER ( Bat[Start Date] )
                    || Bat[match id] <= EARLIER ( Bat[match id] )
            )
    ),
    IF ( ISBLANK ( Bat[Bat Inns] ), 0, 1 )
)

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

amitchandak
Super User
Super User

@Chockers1 , Not very clear, But try a measure like

Bat_RunningTotal_Bat_Innings_Col =
SUMX(
FILTER(
ALL(Bat),
Bat[Player ID] = MAx(Bat[Player ID]) && Bat[Start Date] <= MAx(Bat[Start Date])
),
IF(ISBLANK(Bat[Bat Inns]), 0, 1)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.