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

Cumulative and filtered calculation

Hi Colleagues,

 

I need again some help 🙂

 

In the DB we have AVG volume, and we use for visualisaton a line and clustered chart.

Tha sales team need another avg (we call it cumulative avg volume). Tha calculation is the following:

AVG volume * number of day in month/ number  of day in month.

 

e.g:

january: 1000*31/31

february: ((1000*31)+(1051*28))/59

...

december: ((1000*31)+(1051*28)+....+(1048*31))/365

This is not problem, we can solve it in pl/sql.

 

But the sales team would like to make filtering for example : May and June, where they would like to see 

AVG of May and June: ((1058*31)+(1064*30))/61

 

So this filtering caused for me some difficulty.

 

We have to also calculating margin for these periods, where the methodology is the same, and when we have margin, the we are able to calculate margin%--> margin/ avg volume

 

Do you have some tips for solving this issue?

 

Thank you in advance.

bálint

 

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1667805778920.png

wdx223_Daniel_1-1667805795947.png

 

AvgCumulativeVolume=DIVIDE(SUMX('Sample','Sample'[Number of days in month]*'Sample'[Volume AVG]),SUM('Sample'[Number of days in month]))

View solution in original post

7 REPLIES 7
wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1667805778920.png

wdx223_Daniel_1-1667805795947.png

 

AvgCumulativeVolume=DIVIDE(SUMX('Sample','Sample'[Number of days in month]*'Sample'[Volume AVG]),SUM('Sample'[Number of days in month]))

Anonymous
Not applicable

Hi wdx223_Daniel,

 

I tried the above mentioned solution in the original datamodel, but it is not works there. 

In the dataset is more then 7 mn rows.

There is a volume column, where we can find eop and avg figures also, and there is a flag, where we can choose the eop and avg. 

 

If i make a matrix, and i drop there the volume avg figures, and the number of days, and i make the multiplication and the division, then i get the correct figures. 

But the above mentioned DAX provides back incorrect figures. 

 

Have you any idea for this issue?

 

Thank you!

Anonymous
Not applicable

Thank you, its working fine.

daXtreme
Solution Sage
Solution Sage

Sample data/file needed.

Anonymous
Not applicable

ok

 

Can I pbix file upload here? 

 

I tried upload xls, txt, and powebi, but it doesnot work. 

Thank you

No, only Super Users can upload. But you can paste a link to a file on a shared drive (OneDrive, Google Drive and so on).

Anonymous
Not applicable

Ok, then i make a short table with figures:

 

YearmonthCustomerNumber of days in monthnumber of daysVolume AVGAVG volume weightedAVG volume weighted cumulativeavg cumulative volume
202201XY313110000031000003100000100000
202202xy285910003028008405900840100014
202203xy3190998743096094899693499966
202204xy301209678429035201190045499170
202205xy3115110123431382541503870899594
202206xy30181103496310488018143588100241
202207xy31212145670451577022659358106884

 

So i would like to make a visualisation, where without filtering we can see the avg cumulated avg volume (in the example 202207), but when we filtering for example 202203 and 202204, then (202203 avg volume*31 + 202204avg volume * 30)/61. 

 

Thank you in advance!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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