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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
spamspam
Regular Visitor

Filtering Multiple Date Columns in one Report

Hi All,

 

I have been using Powerbi for a few months, report writing ect and i am stuck on this.

 

I have 3 date columns, for different types of Insurances, i want to be able to see any that are expiring in the next 30 days.

 

So iam using the Grid i can see my 3 Insurance Dates, but the data displaying is only of all 3 of the columns are in the next 30 days, i would like to display if any of the dates are due in the next 30 days. I am currently filtering on the pages level filters (Is in the next 30days)

 

Any help to make it pull from each column? and show nothing if not

 

Cheers 

1 ACCEPTED SOLUTION

Hi @spamspam

 

It seems you may try to use DATEDIFF Function to create the measures for each column as requested. For example:

UpdateWorkersComp =
IF (
    DATEDIFF ( NOW (), MAX ( 'Sample'[Workers comp] ), DAY ) <= 30,
    MAX ( 'Sample'[Workers comp] )
)

1.png

Regards,
Cherie

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

View solution in original post

10 REPLIES 10
spamspam
Regular Visitor

Hello,

          New to PowerBi, I have 3 date fields, they are different types of insurances,with a company name attached to the date field and i need to see the expiery in the next 30 days.

They are currently in the table visual, and i have setup page level filters, Relatative Date Filtering  "IS in the next 30 Days"

 

My problem it is only showing data if all 3 dates are expiering in the next 30 days, how can i make it show data from each indivual date column, and if say 2 date column 2 and 3 are not out it is just blank.

 

Cheers In Advance

 

 

v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @spamspam

 

It seems you may try to use 'Unpivot other columns' in query editor. Then filter the date column as below. If it is not your case, please share some simplified data sample and expected output. You can upload it to OneDrive or Dropbox and post the link here.

How to Get Your Question Answered Quickly

 

1.png

 

Regards,

Cherie

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

Hi Cherie,

 

Thanks for the reply,  Here is my Insurances due in 30 days screen shot

 

To the left if these is just company name. These dates are in the same table

 

Data is only pulling through if any of the Workers Comp/Public or Motor match the condition of 30 days

 

I am expecting alot more data, with some being blank because the expiry is in date.

 

I just have page filters setup on each date column "Is in the next 30 days"

 

Hope this helps to show what iam missing

 

Insurances 30 days.JPG

Hi @spamspam

 

It seems you may try to use DATEDIFF Function to create the measures for each column as requested. For example:

UpdateWorkersComp =
IF (
    DATEDIFF ( NOW (), MAX ( 'Sample'[Workers comp] ), DAY ) <= 30,
    MAX ( 'Sample'[Workers comp] )
)

1.png

Regards,
Cherie

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

Working Dates.JPGWell that now seems to be working thanks for that i can now expand further on this

 

Great work thanks for your help!

Anonymous
Not applicable

Hi @spamspam

 

What I understood from your post is - You have 3 columns with dates in it. You want to find out if any of those dates are falling in next 30 days. Presently your method is showing the results of records where all the 3 dates are within next 30 days. Instead you want to expand the selection from ALL to ANY.

 

I suggest you add one calcualted column to your data model and store the minimum of (Date1,Date2,Date3) in this calculated column. Then base your <30 filter on this new calculated column. 

 

It will work.

 

Hi Sreenath,

 

I have 9 date columns and i want a date filter which when filtered should show any records from any of the 9 date columns falling in the date range. Can you help plz? 

 

For ex: For last 1 month; i want to see all the records that fall in this category from all 9 date columns. Basically if every date column has a date that falls in last 1 month, then those records should show. I am not able to find solution to this. Kindly help. Thanks,

 

Below is the data :

Task#UserTask NamePlanned StartPlanned EndActual StartActual EndIT ApprovalInitial ApprovalTechnical ApprovalFinal ApprovalStatus
1JohnTask 110/2/2023 0:0010/8/2023 0:0010/2/2023 0:0010/8/2023 0:0012/26/2023 0:0011/4/2023 0:0012/13/2023 0:00 In Progress
2JohnnyTask29/12/2023 0:009/27/2023 0:009/12/2023 0:0012/2/2023 0:00    On-hold
3ClaireTask3        On-hold
4VennaTask412/3/2023 0:00 12/3/2023 0:0012/13/2023 0:00    In Progress
5SierraTask59/30/2023 0:0010/4/2023 0:00      Canceled
6AdamTask6        Completed
7JohnTask79/24/2023 0:009/25/2023 0:009/25/2023 0:009/25/2023 0:00    Completed
8JohnnyTask811/6/2023 0:0011/8/2023 0:0011/6/2023 0:0011/11/2023 0:00 11/12/2023 0:0011/19/2023 0:00 Completed
9ClaireTask99/9/2023 0:009/11/2023 0:009/9/2023 0:009/11/2023 0:00 10/1/2023 0:0010/1/2023 0:00 Completed
10VennaTask1012/23/2023 0:001/3/2024 0:0012/23/2023 0:001/3/2024 0:00 1/14/2024 0:001/7/2024 0:001/17/2024 0:00Completed

Hi @sizi 

 

In Power Query, I unpivoted the date columns.

I also added 2 dimension tables (Date and Phase) and created 1:* relationships between the dimension tables and the fact table.

 

Filtering Multiple Date Columns in one Report - 1.pbix

 

Let me know if you have any questions.



Proud to be a Super User!

daxformatter.com makes life EASIER!

I cannot unpivot the date columns in power query. its giving error. My datasource is sharepoint. Is there any other way i can define date filter which can filter dates based on any date column?

Thanks,

Hi @sizi 

 

To unpivot the date columns, I selected [Task#], [User], [Task Name] and [Status] and then right-click and select "Unpivot Other Columns".

 

If this doesn't work, please let me know what the error was.

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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