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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mhendel
Helper III
Helper III

cumulative data base on earlier dates with client filter based on slicer

Hello,

 

First sorry for my English which is not my mother tongue.

 

I have a huge table containing 3 columns : Client reference code, monthly costs and monthly date (first day of the month).

This table contains the data for all clients

 

montlhy costs.png

 In the other hand, i have a slicer which i can use to choose a client reference code.

 

So i can use a Line Chart visual to represents data monthly for one client.

My problem is the following : i need to visualize cumulative costs monthly, by summing the costs of the previous months, based on the client reference code (=slicer) , to obtain something like that : 

Cumulative costs by months for one client.png

I am completely stucked...Someone could help me ?

 

Thanks in advance, 

 

Michael 

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @mhendel 

create a column like

Cumulative Sum = 
CALCULATE(
SUM(Table[monthly costs]),
FILTER(ALL(Table), Table[monthly date] <= EARLIER(Table[monthly date]) && Table[Client reference code] = EARLIER(Table[Client reference code]) )
)

and use it as chart Y-axis value


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

6 REPLIES 6
az38
Community Champion
Community Champion

Hi @mhendel 

create a column like

Cumulative Sum = 
CALCULATE(
SUM(Table[monthly costs]),
FILTER(ALL(Table), Table[monthly date] <= EARLIER(Table[monthly date]) && Table[Client reference code] = EARLIER(Table[Client reference code]) )
)

and use it as chart Y-axis value


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi @az38 ,

 

It is almost what i want, but it remains one problem : 

 

not flat.PNG

 Sometimes, i have no data for one month, and so i wanted my curve to continue to be horizontal when no data is present for that month.  You can see the difference between the two plots.  I dont know if i explain well....

 

Any hint?  Thanks for your help,

 

Michael

az38
Community Champion
Community Champion

Hi @mhendel 

for your new demand you should use a little bit more complicated data model

you need to add a Calendar table, like

Calendar Table = CALENDAR(MIN(Table[monthly date]), MAX(Table[monthly date]))

then create a relationships between calendar table and your table and put Calendar Table[Date] field on the X-axis


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38 Thanks for your quick answer.

My problem is i have in the same table mutliple projects (project code) with several dates for each project...Do i have to split the table by project?  Any hint?

 

Regards?

az38
Community Champion
Community Champion

@mhendel 
no, it should work with regards to filter context

if you will not choose any project it will aggregated by all table.  If you will enable filter by project, it should be filtered 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thanks a lot!!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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