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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
burdenCondo
New Member

How do I create a Rolling Total and Percentage of Total based on multiple columns?

I have a table as follows:

Team CompanyTeam Sub-CompanyEnrollment StatusEnrolled SinceTag
AAAEnrolled2023-01-01123
AABEnrolled2023-01-02123 || 456
BBANot Enrolled  
CCANot Enrolled 789

 

The table shows the Enrollment Status to a program of Teams, which have other metadata such as Company, Sub-Company, Tags, etc. The "Enrollment Status" column indicates whether the team enrolls to a program or not, and if they are, then it has a column "Enrolled Since" as date.

 

I want to create 4 new columns:

  • "Enrolled Count so far by Company"
  • "Enrolled Percentage so far by Company"
  • "Enrolled Count so far by Sub-Company"
  • "Enrolled Percentage so far by Sub-Company"

As you see, the last two columns are just the former two columns, but using a different team. This is what I am looking for:

Team CompanyTeam Sub-CompanyEnrollment StatusEnrolled SinceTagEnrolled Count so far by CompanyEnrolled Percentage so far by CompanyEnrolled Count so far by Sub-CompanyEnrolled Percentage so far by Sub-Company
AAAEnrolled2023-01-01123150%1100%
AABEnrolled2023-01-024562100%1100%
BBANot Enrolled  10%1100%
CCANot Enrolled 78910%1100%

 

I can easily calculate that using a Native database query (in my case, Snowflake). However, what I am unable to make it right is when I apply the filters. I observe that the query calculates the values first to get the data, then when the filter is applied (e.g., I filter rows when tag contains "123" only), the new values are NOT re-calculated. This is what I get when I use that tag filter:

Team CompanyTeam Sub-CompanyEnrollment StatusEnrolled SinceTagEnrolled Count so far by CompanyEnrolled Percentage so far by CompanyEnrolled Count so far by Sub-CompanyEnrolled Percentage so far by Sub-Company
AAAEnrolled2023-01-01123150%1100%

 

As you can see, the filter does not trigger the re-calculation, which it should. 

 

My question:

  • Is it possible to apply filter first, then do calculations via the Measure/DAX/whatever it is by PowerBI?
  • If yes, then how should I write the Measure/DAX queries?
1 REPLY 1
rubayatyasmin
Super User
Super User

Hi, @burdenCondo 

 

You can apply filter first then create measure in PBI. 


you can try below code for after filtering. 

Enrolled Count by Company =
CALCULATE(
COUNT('Table'[Enrollment Status]),
'Table'[Enrollment Status] = "Enrolled",
ALLEXCEPT('Table', 'Table'[Team Company])
)

 

 

Enrolled Percentage by Company =
DIVIDE(
[Enrolled Count by Company],
CALCULATE(
COUNT('Table'[Enrollment Status]),
ALLEXCEPT('Table', 'Table'[Team Company])
),
0
)

 

It should work. Please make the necessary changes in DAX. 

If my assistance helped you in any way, hit 👍

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors