cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
joniemaximus
Frequent Visitor

Running Total

I have a simple data model recording accidents per month and want to create a bar graph showing month accidents and a running total.

 

Normally this wouldn't be an issue but our Accidents data uses a start month of May i have a custom column to give a value of 1 to May, 2 to June etc. If i create the acumulative total on this value everything works fine:

joniemaximus_0-1634731116657.png

However i'd rather show the month names rather than number. If i chage the axis the date changes and only shows the actual figure:

joniemaximus_1-1634731187116.png

 

The month Name isn't a numerical fielf for me to use in the accumulation calulation. Is there a way to do this?

joniemaximus_2-1634731256964.png

 

My measure is:

 

ACCU TY =
VAR MaxW = calculate(max('Calendar'[HSMonth]),'Calendar'[HSYear] = 2021)
return CALCULATE(
    CustomMeasures[AccidentsTy],
    FILTER(
        ALLSELECTED('Calendar'[HSMonth]),
        ISONORAFTER('Calendar'[HSMonth], MaxW, DESC)
    )
)
4 REPLIES 4

Hi @joniemaximus 

 

Try this:

 

Meausre=
CALCULATE(
    [AccidentsTy],
    FILTER(
        all(Calendar),Calendar(date)<=max(calendar(date)
)
)

 

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

 

Appreciate your Kudos!!

 

Thanks Vahid, that just gives me a complete total which is the same each month:

joniemaximus_0-1634731937405.png

It shows the total rather than a running total on both graphs (MonthName and HSMonth)

It would be better if you shared a sample of your data or the PBIX file.

BTE, try this:

Meausre=
CALCULATE(
    [AccidentsTy],
    FILTER(
        all(Data),Data(date)<=max(calendar(date)
)
)

 

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

 

Appreciate your Kudos!!

 

Thanks Vahid,

 

Almost there. is there a way to account for zero values. Currently it looks like this:

joniemaximus_0-1634733207803.png

If i use the measure that adds 0 values for the barchart i get the result below:

joniemaximus_1-1634733298744.png

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors