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
Anonymous
Not applicable

DIVIDE monthly rows per category by total table rows

Hi guys,

I'm pretty new to Power Bi, and I've been struggling with the table task below.

 

I've got the following table where each row is either ACTUAL or PLANNED.

CostSourceCount is counting how many ACTUAL or PLANNED rows I've got per month. 

 

glausantos_0-1622432441988.png

What I want to achieve with the TotalPlanned column is to divide the COUNT of CostSource / COUNT of Total Table Rows.

Something like this:

MonthCostSourceCostSourceCountTotalPlanned
JanACTUAL20.1%
JanPLANNED165499.9%
FebACTUAL1647.1%
FebPLANNED214992.9%
MarACTUAL49820.3%
MarPLANNED195879.7%

 

I tried the formula below, but all rows are returning 100% 

 

TotalPLanned =
VAR Total = COUNTROWS(VW_PlacementMonthlyBilling)
Var Actual = CALCULATE(COUNTROWS(Table1), FILTER(Table1,Table1[CostSource]="Actual"))
Var Planned = CALCULATE(COUNTROWS(Table1), FILTER(Table1,Table1[CostSource]="Planned"))
RETURN
IF(
DIVIDE(Actual,Total)=0,DIVIDE(Planned,Total), DIVIDE(Actual, Total))
 
Does anyone know a better way to do this? It has to be a measure because I have to create a bar afterwards
 
glausantos_0-1622434557684.png

 


Thanks,
G
3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

 

Picture4.png

 

CostSourceCount Measure =
SUM('Table'[CostSourceCount])
 
TotalPlanned =
DIVIDE (
[CostSourceCount Measure],
CALCULATE ( [CostSourceCount Measure], ALLEXCEPT ( 'Table', 'Table'[Month] ) )
)
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hi Jihwan,

 

Thank you, that was helpful. 

Would it be possible to add another column where I divide the ACTUAL by PLANNED?

E.g.

April ACTUAL 1014 / PLANNED 1840 = 55%

April PLANNED 1840/ PLANNED 1840 = 100%

Hi, @Anonymous 

Thanks for your feedback.

I am not sure if I understood your question correctly, but please check the below.

 

Picture2.png

 

Divide by Planned =
IF (
ISFILTERED ( 'Table'[Month] ),
DIVIDE (
[CostSourceCount Measure],
CALCULATE ( [CostSourceCount Measure], 'Table'[CostSource] = "PLANNED" )
)
)

 

 

https://www.dropbox.com/s/nf2k3auq1oslg0i/glausantos.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.