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

See when key Fabric features will launch and what’s already live, all in one place and always up to date. Explore the new Fabric roadmap

Reply
DiKi-I
Post Patron
Post Patron

Read files content dynamically

Hi All,

I have a file where in one single sheet , I'm getting a number of metrics in rows.

for eg net revenue starts at rows no 20 and goes to 200, similarly other metrices like profit etc. Currently i'm using dataflow to restrict it using top/bottom rows. I there way to make this dynamic or less manual , I don't have any other way rather than using row number. Its just numbers in the sheets so it also not possible to filter on the metric name.

3 REPLIES 3
v-hashadapu
Community Support
Community Support

Hi @DiKi-I ,
I wanted to follow up and see if you’ve had a chance to review the information provided here.
If any of the responses helped solve your issue, please consider marking it "Accept as Solution" and giving it a 'Kudos' to help others easily find it.
Let me know if you have any further questions!

v-hashadapu
Community Support
Community Support

Hi @DiKi-I , Thank you for reaching out to the Microsoft Community Forum.

 

You're currently stuck manually entering row numbers in Dataflow to extract metrics like net revenue and profit from a sheet that only contains numbers, with no metric names to filter on. Since there's no label or identifier in the data itself, dynamic filtering is tricky but there are a few ways to handle this. The most reliable method is to maintain a separate mapping table that defines the start and end rows for each metric.

 

For example:

| Metric     | Start Row | End Row |

| NetRevenue | 20        | 200     |

| Profit     | 201       | 300     |

 

You can reference this table in your Dataflow logic to dynamically extract the rows you need, which avoids hardcoding and makes updates much easier when the structure changes. If you have control over the data before it reaches the sheet, another option is to tag each row during ingestion with the metric name in a separate column.

 

For example:

| Metric     | Value  |

| NetRevenue | 100.2  |

| NetRevenue | 105.6  |

| Profit     | 55.1   |

 

This lets you filter rows dynamically by metric name in Dataflow without relying on row positions. Finally, if your sheet has consistent patterns like blank rows between metric blocks, you can use a Google Apps Script to detect the start and end of each block automatically.

 

Example:

function detectMetricBlocks() {

  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();

  const data = sheet.getDataRange().getValues();

  const blocks = [];

  let start = null;

 

  for (let i = 0; i < data.length; i++) {

    const isEmpty = data[i].every(cell => cell === "" || cell === null);

    if (!isEmpty && start === null) start = i + 1;

    else if (isEmpty && start !== null) {

      blocks.push({ start, end: i });

      start = null;

    }

  }

  if (start !== null) blocks.push({ start, end: data.length });

  return blocks;

}

 

If this helped solve the issue, please consider marking it “Accept as Solution” and giving a ‘Kudos’ so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.

GilbertQ
Super User
Super User

Hi @DiKi-I 

 

Is it not possible that on the columns you will have some information which could identify which roads you need So that will allow you to then filter then dynamically?





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

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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

Top Kudoed Authors