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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
laciodrom_80
Helper IV
Helper IV

Trying to improve queryng dataset using M-language

Hi all,

 

I've got a dataset consisting of a sql db and an azure blob storage: in the sql db I've got a table Series containing some numeric series information such as Serie Name, Type, Granularity, ... while in the blob storage I've got a lot of csv files each containing series values, dates, and corresponding serie's name. Series values in csv files are linked with the corresponding record on sql db by Serie Name column in Series Table.

 

Series Table columns

Serie Name - Type - Granularity

 

Csv files columns

Serie Name - Value - Date

 

In my report I have to display data only for one serie typology so, in order to have a smaller dataset, I'd like to load from csv files only data about the series with the typology of interest (not all ones and then filtering them into the report by typology).

 

This is the query in M-language I use to get csv files in the blob storage directory, should I enrich it with a condition on Series table? Is it possible? 

 

= Table.SelectRows(dir, each Text.StartsWith([Name], "Dir/Default/REAL/"))

 

Thanks a lot in advance for any clue

Luca
1 ACCEPTED SOLUTION

Hi @v-jiascu-msft,

 

solved using Merge Queries

 

Regards

Luca

View solution in original post

5 REPLIES 5
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @laciodrom_80,

 

Could you please mark the proper answers as solutions?

 

Best Regards,

Dale

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

Hi @v-jiascu-msft,

 

solved using Merge Queries

 

Regards

Luca
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi Luca,

 

This is possible. But it will be complicated in the production environment. Please refer to the M code below. The second one invokes the values from the first one. It could give you some ideas.

//ColorsTable
let Source = Csv.Document(File.Contents("D:\DataSource\a.csv"),[Delimiter=",", Columns=1, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers"
let
    colors = ColorsTable[Color],
    Source = Sql.Database("dal6", "contosoretaildw", [Query="select * from dimproduct where colorname in ('" & Text.Combine(colors, "','") & "')"])
in
    Source

 

Best Regards,
Dale

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

Thanks @v-jiascu-msft for the hint.

What do you mean about "it will be complicated in the production environment" ?

 

Best Regards

Luca

Hi Luca,

 

There could be more situations to handle and more exceptions to catch. Some possibilities are as follows.

1. More than one CSV files. You could combine them first.

2. The blank values in the CSV files. 

3. The performance. 

In the test, I just use one file and one SQL query. Anyway, you can give it a try. I would appreciate it if you can share the results. 

 

Best Regards,
Dale

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.