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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Sulaimon
Regular Visitor

Record Query

Good morning everyone,

My name is Sulaimon from Nigeria, Please i need help on my power bi report.

I want to query a record base on date range, for example

i have a record with columns and a date column and want to query this record to return data based on date range. For instance want to see only records between 1 to 15 days of every month. like 1 june 2022, 3 june 2022, 5 june 2022, 7 june 2022, 2 july 2022, 4 july 2022, 5 july 2022, 8 july 2022, 11 july 2022 and 13 july 2022 and so on... Will be very grateful if resolved

Document NoOrder_NoPosting_DateQuantityAmount
  1 june 2022  
  3 june 2022  
  5 june 2022  
  7 june 2022  
  21 june 2022  
  23 june 2022  
  2 July 2022  
  4 July 2022  
  5 July 2022  
  8 July 2022  
  11 July 2022  
  13 July 2022  
  21 July 2022  
  23 July 2022  
     
1 ACCEPTED SOLUTION
jbwtp
Memorable Member
Memorable Member

Hi @Sulaimon,

 

Something like this?

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtIBIUNdr9I8XSMjCE8pVgcmYYxLwhSXhDkuCSOclhjhtMUIKJGDTcIEl4QpLgkLXBKGhjhljHHJGOHUY4SuJxYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"ocument No" = _t, Order_No = _t, Posting_Date = _t, Quantity = _t, Amount = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ocument No", type text}, {"Order_No", type text}, {"Posting_Date", type date}, {"Quantity", type text}, {"Amount", type text}}),
    #"Inserted Day" = Table.AddColumn(#"Changed Type", "Day", each Date.Day([Posting_Date]), Int64.Type),
    #"Filtered Rows" = Table.SelectRows(#"Inserted Day", each Date.Day([Posting_Date]) >= 1 and Date.Day([Posting_Date]) <= 15)
in
    #"Filtered Rows"

 

The filter in the #"Filtered Rows" step. You can filter on any date and then change it manually in the editor.

 

Kind regards,

John

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Sulaimon ,

 

Did @jbwtp 's method solve your problem?

If it did, please mark the reply as a solution. And more people will benefit from it.

 

 

Best Regards,

Stephen Tao

jbwtp
Memorable Member
Memorable Member

Hi @Sulaimon,

 

Something like this?

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtIBIUNdr9I8XSMjCE8pVgcmYYxLwhSXhDkuCSOclhjhtMUIKJGDTcIEl4QpLgkLXBKGhjhljHHJGOHUY4SuJxYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"ocument No" = _t, Order_No = _t, Posting_Date = _t, Quantity = _t, Amount = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ocument No", type text}, {"Order_No", type text}, {"Posting_Date", type date}, {"Quantity", type text}, {"Amount", type text}}),
    #"Inserted Day" = Table.AddColumn(#"Changed Type", "Day", each Date.Day([Posting_Date]), Int64.Type),
    #"Filtered Rows" = Table.SelectRows(#"Inserted Day", each Date.Day([Posting_Date]) >= 1 and Date.Day([Posting_Date]) <= 15)
in
    #"Filtered Rows"

 

The filter in the #"Filtered Rows" step. You can filter on any date and then change it manually in the editor.

 

Kind regards,

John

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.