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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jmdaily83
Helper II
Helper II

Assign specific value to repeating blanks in a column based on the order they're in

Hello - I have a table similiar to the sample table below.  The subtotal1/subtotal2/total does not pull in with my query due to the way the files are structured and pulled in.  The blanks will always be in the same order for each project but not necessarily in the same amount of rows from the previous section. (ie subtotal 1 could have 15 rows above it in Project A and 25 above it in Project B). I need to create a new column that assigns subtotal1/subtotal2/total based on these blanks.  

 

I have tried this custom column but it does not work, it just spins & spins and never even shows an error.  

= Table.AddColumn(#"Added Index", "Custom", each let

__Project = [Project Number],

__Index = [Index],

__Table = Table.SelectRows( #"Added Custom", each ([Project Number] = __Project and [Index] > __Index ) )

in

  Table.RowCount(__Table) + 1)

 

 

 

ProjectkWh CategoryItem CategoryItem Type$New KWH Category
AEngineeringBESS EngineeringElectrical100Engineering
AMBOM MaterialBESS MaterialBESS Material200MBOM Material
ABOP MaterialElectrical BOP MaterialAux Material300BOP Material
AEPC BOPBOP CivilCivil400EPC BOP
ASubstationSubstationSubstation Engineering500Substation
ATransmission LineTransmission LineTransmission Line600Transmission Line
ASubstationSubstationSubstation700Substation
AFreightFreightMBOM+BOP Freight800Freight
AEPC BOPOtherInsurance900EPC BOP
AMBOM MaterialBESS MaterialWarranties1000MBOM Material
AProject ServicesSite LabourSite Labour1100Project Services
A   6600Subtotal 1
AEPC BOPOtherPermitting1300EPC BOP
AContingencySourcing ContingencySourcing Contingency1400Contingency
A   9300Subtotal 2
ASales TaxSales TaxSales Tax1600Sales Tax
ABonding BondingBonding1700Bonding 
A   12600Total
BEngineeringBESS EngineeringElectrical100Engineering
BMBOM MaterialBESS MaterialBESS Material200MBOM Material
BBOP MaterialElectrical BOP MaterialAux Material300BOP Material
BEPC BOPBOP ElectricalBESS  Site Commissioning400EPC BOP
BSubstationSubstationSubstation Engineering500Substation
BTransmission LineTransmission LineTransmission Line600Transmission Line
BSubstationSubstationSubstation Commissioning700Substation
BFreightFreightMBOM+BOP Freight800Freight
BEPC BOPOtherInsurance900EPC BOP
BMBOM MaterialBESS MaterialWarranties1000MBOM Material
BProject ServicesSite LabourSite Labour1100Project Services
B   6600Subtotal 1
BEPC BOPOtherPermitting1200EPC BOP
BContingencySourcing ContingencySourcing Contingency1300Contingency
BContingencyRisk ContingencyRisk Contingency1400Contingency
B   10500Subtotal 2
BSales TaxSales TaxSales Tax1500Sales Tax
BBonding BondingBonding1600Bonding 
B   13600Total
4 REPLIES 4
jmdaily83
Helper II
Helper II

The end user ended up adjusting the way things were labeled on their end so I no longer needed to do anything custom on my end. 

thank you all for your help

Anonymous
Not applicable

Hi @jmdaily83 ,

 

You'd better add a level2 column in you table to dispaly your second level. And it's best to determine this level and import it together before importing, which is more convenient.

Column = CALCULATE(SUM('Table'[$]),FILTER('Table',[Project]=EARLIER('Table'[Project])&&[Level2]<=EARLIER('Table'[Level2])))

vstephenmsft_0-1722850859203.png

Best Regards,

Stephen Tao

 

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

 

Ashish_Mathur
Super User
Super User

Hi,

Not sure of what you want but you should never create subtoal/total rows in any table.  These summarisation rows get created automatically when you create Table/matrix visuals.


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

@Ashish_Mathur Thank you for your response. That's how I would typically do it, but in this particular visual the subtotals need to add together and this does not happen naturally in a matrix. So I need Subtotal 1, Subtotal 2 = subtotal 1 + subtotal 2, total = item A + item B + Subtotal 1 + Subtotal 2

 

Current matrix functionality

jmdaily83_1-1721222164148.png

 

 

What I need - (notice no subtotal 3) and subtotals are added together

jmdaily83_2-1721222257632.png

 

 

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.