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
gerasimovav
Helper III
Helper III

How to view this year dynamic per months? (Comulative Total per months)

Hello colleagues!

I often have to do similar task.

For example, we register incidents every day.

I can count incident by countrows measure, then put diagram: X axis is month and Y axis is amount of incident. 

For example, 5 in January, 3 in February, 2 in March...

There is no problem if I want to view amount of incident every months.

But if i want to view number of incident from the start of the year till the end of every month:

for example January - 5, February 8 (5+3), March 10 (5+3+2) - it is very difficult.

How can I plot this graph?

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

Create a Calendar Table and write the following calculated column formulas there.

 

Year=Year(Calendar[Date])

Month=FORMAT(Calendar[Date],"mmmm")

 

Build a relationship from the Date column of the base Data Table to the Date column of the Calendar Table.  In your Table visual, drag the Year and Month from the Calendar Table.  Write these measures:

 

Incidents = COUNTROWS(Data)

Incidents YTD = CALCULATE([Incidents],DATESYTD(Calendar[Date],"31/12")

 

Your Months on the x-axis will not be in order.  Just Google for how to get months in order in PowerBI desktop and yo will be able to see the simple procedure.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

11 REPLIES 11
v-juanli-msft
Community Support
Community Support

Hi @gerasimovav

As tested, Ashish_Mathur's reply can lead you directly to the results you wanted.

While Greg_Deckler's link provides the method to solve this kind problem, after reading , you may learn a lot and implement it in your scenario.

 

If you'd like to put the end of every month as Axis, you could create a column in the "calendar" table, i make a test as below.

create a column
end of month = CALCULATE(MAX('calendar'[Date]),ALLEXCEPT('calendar','calendar'[month]))

create a measure
Measure = COUNTROWS(Sheet1)
Measure 3 = CALCULATE([Measure],FILTER(ALL('calendar'),'calendar'[month]<=MAX('calendar'[month])))
1.png
 
Best Regards
Maggie

Thank you very much!

All of the answers are good, but @Ashish_Mathur's answer is the most convenient way for me.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur thank you again.

I've deployed your way, it works. But there is one moment. The result graph doesn't depend on filters. If we have different types of incident, for example high, medium and low. If I put the slicer for this types and choose high, montly graph shows dynamic of high incidents per month, but total year graph still shows all of incidents...

It should work.  Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

Download the PBI file from here.  Get the months in the first table in order.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur thank you a lot!!!

Was my mistake using Column instead of measure?

Yes and also the relationship.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

 

Create a Calendar Table and write the following calculated column formulas there.

 

Year=Year(Calendar[Date])

Month=FORMAT(Calendar[Date],"mmmm")

 

Build a relationship from the Date column of the base Data Table to the Date column of the Calendar Table.  In your Table visual, drag the Year and Month from the Calendar Table.  Write these measures:

 

Incidents = COUNTROWS(Data)

Incidents YTD = CALCULATE([Incidents],DATESYTD(Calendar[Date],"31/12")

 

Your Months on the x-axis will not be in order.  Just Google for how to get months in order in PowerBI desktop and yo will be able to see the simple procedure.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Super User
Super User

There are Running Total Quick Measures. Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.