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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
et6861
New Member

Create a cumulative line chart that will updated cumulative value based on category filters

Hi,

I have the below dataset. I need to create a line chart of cumulative volume, where I want to be able to filter based on Object, Object Sub-unit or Batch and the graph will update to show the cumulative volume for the objects that are selected by the filter. (i.e. I want a line graph that can show the cumulative volume provided by Objects just in Batch 1 or the cumlative volume provided by Object Sub unit A or the cumulative volume provided by all objects). I have included date but i don't need the cumulative based on date, I would just like to sort the objects by date.

 

I am struggling based on other posts to work out how to do this, so any help would be much appreciated.

 

Thanks.

 

ObjectObject Sub-UnitGroupDateVolume
A-100A119/09/20103.36
A-100B119/09/20108.48
A-100C119/09/201016.12
A-100D119/09/201015.27
A-200A229/09/20104.73
A-200B229/09/201013.49
A-200C229/09/20109.98
A-200D229/09/20107.70
A-300A106/10/20103.59
A-300B106/10/201012.44
A-300C106/10/201012.22
A-300D106/10/20107.68
Z-250A325/10/20106.77
Z-250B325/10/201017.52
Z-250C325/10/201011.15
Z-250D325/10/20104.39
Z-300A230/10/20101.60
Z-300B230/10/201014.17
Z-300C230/10/20104.46
Z-300D230/10/20103.57
A-400A105/11/20102.33
A-400B105/11/201011.07
A-400C105/11/201012.45
A-400D105/11/20104.52
A-500A212/11/20102.35
A-500B212/11/20107.29
A-500C212/11/201015.96
A-500D212/11/201012.90
Z-600A314/11/20107.50
Z-600B314/11/201013.90
Z-600C314/11/201011.64
Z-600D314/11/20106.82
1 ACCEPTED SOLUTION

Hi @et6861 

Please check if the below measure matches your request.If it is not your case,please explain more about your expected output.Attached sample file for your reference.

 

Cumulative  Volume = 
CALCULATE (
    SUM ( Sheet1[Volume] ),
    FILTER ( ALLSELECTED( Sheet1 ), Sheet1[Date] <= MAX ( Sheet1[Date] ) )
)

Regards,

 

Community Support Team _ Cherie Chen
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

7 REPLIES 7
tex628
Community Champion
Community Champion

Volume=
VAR mdate = max(table[date])
VAR myear = Year(mdate)
return
Calculate(sum(table[volume]); all(table[date]); table[Year] = myear ; table[date] <=mdate)

You need to make a year column from your date column, then try this. Should work dynamically with object/object sub-unit/group being placed in normal slicers.


Connect on LinkedIn

Here's a similar pattern with a Calendar Table, the need for a year variable is only required if you are doing a year to date calculation. Cumulative Volume = VAR SelectedDate = MAX(Data[Date]) RETURN CALCULATE(SUM([Volume]), ALL('Calendar'), 'Calendar'[Date] <= SelectedDate)

Hi both, many thanks for your response. I have tried this and it seems to just calculate the cumulative volume for all objects and then have that as a single value for each object so my cumulative vol vs. object line graph is just a straight line... any dieas what i'm doing wrong? I created a measure using the formula below

 

 


Cumulative  Volume = VAR mdate = max(Sheet1[Date].[Date])return Calculate(sum(Sheet1[Volume]),ALL(Sheet1),Sheet1[Date]<=mdate)

Hi @et6861 

Please check if the below measure matches your request.If it is not your case,please explain more about your expected output.Attached sample file for your reference.

 

Cumulative  Volume = 
CALCULATE (
    SUM ( Sheet1[Volume] ),
    FILTER ( ALLSELECTED( Sheet1 ), Sheet1[Date] <= MAX ( Sheet1[Date] ) )
)

Regards,

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-cherch-msft yes this has worked. Many thanks for your help!

tex628
Community Champion
Community Champion

@et6861  Did you meake a measure or a calculated column?


Connect on LinkedIn
tex628
Community Champion
Community Champion

@dannois correct, the year column is only necessary for a YTD. My misstake! 🙂


Connect on LinkedIn

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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