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
Vroom_Master3
Helper I
Helper I

Dividing Current Months Count by Previous Months Count for a Monthly Graph

I am tracking passing scores over time. The data comes in randomly throughout the month. 
So I have to divide the current months count of passing grades by the count of last months passing grades. This should come out to a monthly bar graph showing the "Sustainment" Percentage. 
Here is some example data:

1-Jan72
7-Jan80
13-Jan84
30-Jan52
3-Feb75
4-Feb82
16-Feb86
20-Feb86
25-Feb88
1-Mar70
4-Mar82
6-Mar88
19-Mar84
21-Mar75

 

My problem is that measures filter on monthly graphs very distinctly, and I'm having problems referencing the previous months. The best I hav ever gotten was showing the current month versus the previous month, but no showing any other months. Sadly, i don't have those measures anymore, but I do have what the graph should look. Granted this is a different graph entirely and not this specific data set. 

Vroom_Master3_0-1712599015535.png

 

Thanks for the help. 

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Vroom_Master3 

pls check if this is what you want

create a date table and create measures

11.PNG

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
v-xuxinyi-msft
Community Support
Community Support

Hi @Vroom_Master3 

 

Thanks for the reply from @ryan_mayu , please allow me to provide another insight:

 

1. Create a calculated column

Month = MONTH([Date])

 

2. Create several measures as follow

current = CALCULATE(COUNT('Table'[grades]),  ALL('Table'), 'Table'[grades] >= 60, 'Table'[Month] =  MAX([Month]))

 

Max = 
VAR _maxMonth = MAXX(ALL('Table'), [Month])
VAR _max = CALCULATE(COUNT('Table'[grades]),  ALL('Table'), 'Table'[grades] >= 60, 'Table'[Month] =  _maxMonth)
RETURN
_max

 

divide = DIVIDE([Max], [current])

 

Result:

vxuxinyimsft_0-1712655822477.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This is correct, but only partly. I might be able to make it the rest of the way given this, but your data is offset by a month. Given three months of data you shouldnt be able to calculate 1 month. Its:
'This Months passing grades' / ' Last months passing grades'  
Given this, January should have no data. Your solution calculates as a month versus next month, and because of this, Assigns a 100% to the most recent month

Vroom_Master3_0-1712668286761.png

The output in the real data.  Given my data runs Feb-April not Jan-March

Hi @Vroom_Master3 

 

Please check if @ryan_mayu answer meets your needs.

 

Best Regards,
Yulia Xu

ryan_mayu
Super User
Super User

@Vroom_Master3 

pls check if this is what you want

create a date table and create measures

11.PNG

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.