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
jhartranft60
Advocate IV
Advocate IV

Cumulative by week breaks at Week 10

 

 

Hello,

 

I've created a measure to count enrollments week over week.  My data is sliced by week and by session (each session has 8-10 weeks, depending on time of year).  I'm using the following formula:

 

Cumulative_Enrollments = CALCULATE(SUM(Enrollments[Count], FILTER( ALLEXCEPT(Enrollments, Sessions[Session]), Enrollments[Week_Num]<=Max(Enrollments[Week_Num])))

 

*Note - There is a relationship built between Enrollments[Session] & Sessions[Session] that allows filtering by session across several charts/tables in the dashboard. That's why the ALLEXCEPT() function above references a different table than the rest of the formula.

 

This formula works absolutely perfect for any session I filter to that have 8 or 9 weeks, but if I filter to a 10-week session, the calculation begins with the Week 10 enrollment count.  I don't have any of the columns sorted in any way that 10 would come before 1, so I'm stumped.  I know I haven't provided much data, but hoping the answer may be simple.  If not, I will be happy to provide any sample data that may be needed.

  

 Cumulative.JPG

1 ACCEPTED SOLUTION

A colleague & I were able to determine a solution.  Thanks!

View solution in original post

4 REPLIES 4
v-yulgu-msft
Employee
Employee

Hi @jhartranft60,

 

In data table 'Enrollments', is [Week_Num] formatted as numeric (e.g 1, 2, 3, 4...10) or text (e.g Week1, Week2, Week3... Week10)? If it is a Text field, you need to add an extra column to sort the [Week_Num] column numerically rather than alphabetically.

 

Reference: Custom Sorting in PowerBI

 

Best regards,

Yuliana Gu

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

Hello @v-yulgu-msft,

 

Thank you for replying.  Week_Num is formatted as a whole number.  The chart is using a column "Week Text" on the X-Axis and is sorted Ascending using the Week_Num column.

 

-Jeremy

Hi @jhartranft60,

 

Please provide sample data for test.

 

Regards,

Yuliana Gu

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

A colleague & I were able to determine a solution.  Thanks!

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.