cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rodfernandez
Helper I
Helper I

cumulative bar graph

I have the following Graph 
1.png
but I want to create a cumulative graph of the previous graph.
I create the following code

Acomulado RCA = 
CALCULATE(
	COUNTA('Reporte'[Etiqueta]);
	FILTER(
		CALCULATETABLE(
			SUMMARIZE('Reporte'; 'Reporte'[Mes]; 'Reporte'[Mes Name]);
			ALLSELECTED('Reporte')
		);
		ISONORAFTER(
			'Reporte'[Mes]; MAX('Reporte'[Mes]); DESC;
			'Reporte'[Mes Name]; MAX('Reporte'[Mes Name]); DESC
		)   
	)
)

that produce the following bar graph 

 

2.png

This is more or less what I wanted but I need that each element persist in time, for example for January in the first graph you have 1 yellow so in the cumulative graph you should have 1 yellow, so is fine. In February you have 1 red in the normal graph so in the cumulative graph you should have 1 yellow and 1 red, .... For March you should have 1 yellow, 1 red and 1 green, in May 1 yellow, 1 red and 3 green,....and so on 
what should I change in my code make each color persist over time?

 

 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @rodfernandez 

You could try this way:

Step1:

Create a fact Mes table, then create the relationship with report table by Mes

5.JPG

Step2:

Use this formula to add a measure

Acomulado RCA = 
CALCULATE (
    COUNTA ( 'Reporte'[Etiqueta] ),
    FILTER (
        ALLSELECTED ( Mes ),
        ISONORAFTER ( 'Mes'[Mes], MAX ( 'Mes'[Mes] ), DESC )
    )
)

Result:

4.JPG

 

and here is my sample pbix file, please try it.

 

Best Regards,

Lin

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

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi, @rodfernandez 

You could try this way:

Step1:

Create a fact Mes table, then create the relationship with report table by Mes

5.JPG

Step2:

Use this formula to add a measure

Acomulado RCA = 
CALCULATE (
    COUNTA ( 'Reporte'[Etiqueta] ),
    FILTER (
        ALLSELECTED ( Mes ),
        ISONORAFTER ( 'Mes'[Mes], MAX ( 'Mes'[Mes] ), DESC )
    )
)

Result:

4.JPG

 

and here is my sample pbix file, please try it.

 

Best Regards,

Lin

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

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors
Top Kudoed Authors