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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
johnwrite
Frequent Visitor

Filter Datetime Column based on another Column

Hi Guys ,

 

I am new to power BI .I want the visuals to interact in such a way that only some of the filters in the selected visual apply to the other visual, while other filters do not. Below is the data table i have 

 

 

cws.JPG

 

 

 Now what I need is the rows of 'day' and 'count' present in between 'cws' and 'cwe' . Null values will be there for first two columns , so i am unable to filter it by comparing day with cws and cwe columns.  By having a visual filter for cws and cwe , it should be able to show me the day and counts between september 3rd and september 11th i.e., September 6th and september 7th from day column along with their counts . 

 

cwe.jpg

I am also fine if I can have another line that starts from september 6th and end with september 7th .  Any inputs/solution on this would be really helpful to me .

 

 Thanks

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @johnwrite,

 

According to your description, you want to use the column “cws” and “cwe” to filter the records, right?

 

If as I said, you can refer to below steps:

Source table:

Capture.PNG
 

Open the Advanced Editor to add two variables to get the values from “cws“ and “cwe”.


Formulas:


Cws = List.First(Table.SelectRows(Table.SelectColumns(#"Changed Type","Cws"), each [Cws] <> null)[Cws]),
Cwe =List.First(Table.SelectRows(Table.SelectColumns(#"Changed Type","Cwe"), each [Cwe] <> null)[Cwe]),

 

Add a filter rows function and use above variables to filter records.


Formula:
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Day] >= Cws and [Day] <= Cwe )

 

Result:

Capture2.PNG
 

Full query:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtIBIQt9YwN9IwNDMyDbzFIpVgdJwhAugSRuqQ8XNjZGETeCiRsZooibwcWNUMTN0cyx1DeGiQAtgdsCQrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Cws = _t, Cwe = _t, Day = _t, Count = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Cws", type date}, {"Cwe", type date}, {"Day", type date}, {"Count", Int64.Type}}),
    Cws = List.First(Table.SelectRows(Table.SelectColumns(#"Changed Type","Cws"), each [Cws] <> null)[Cws]),
    Cwe =List.First(Table.SelectRows(Table.SelectColumns(#"Changed Type","Cwe"), each [Cwe] <> null)[Cwe]),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Day] >= Cws and [Day] <= Cwe )
in
#"Filtered Rows"

 

 

Reference:


List.First
Table.SelecRows

Table.SelectColumns

 

Regards,
Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @johnwrite,

 

According to your description, you want to use the column “cws” and “cwe” to filter the records, right?

 

If as I said, you can refer to below steps:

Source table:

Capture.PNG
 

Open the Advanced Editor to add two variables to get the values from “cws“ and “cwe”.


Formulas:


Cws = List.First(Table.SelectRows(Table.SelectColumns(#"Changed Type","Cws"), each [Cws] <> null)[Cws]),
Cwe =List.First(Table.SelectRows(Table.SelectColumns(#"Changed Type","Cwe"), each [Cwe] <> null)[Cwe]),

 

Add a filter rows function and use above variables to filter records.


Formula:
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Day] >= Cws and [Day] <= Cwe )

 

Result:

Capture2.PNG
 

Full query:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtIBIQt9YwN9IwNDMyDbzFIpVgdJwhAugSRuqQ8XNjZGETeCiRsZooibwcWNUMTN0cyx1DeGiQAtgdsCQrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Cws = _t, Cwe = _t, Day = _t, Count = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Cws", type date}, {"Cwe", type date}, {"Day", type date}, {"Count", Int64.Type}}),
    Cws = List.First(Table.SelectRows(Table.SelectColumns(#"Changed Type","Cws"), each [Cws] <> null)[Cws]),
    Cwe =List.First(Table.SelectRows(Table.SelectColumns(#"Changed Type","Cwe"), each [Cwe] <> null)[Cwe]),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Day] >= Cws and [Day] <= Cwe )
in
#"Filtered Rows"

 

 

Reference:


List.First
Table.SelecRows

Table.SelectColumns

 

Regards,
Xiaoxin Sheng

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.