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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Filtering on 2 date fields in a table

Hi

 

I'm trying to write a report that contains 2 table with one slicer that filters on financial year and month.  The first table will contain a list of all the inspections created within the month selected in the slicer for example all the inspections created in May 2018 The second table contains the a list of all the inspections created within the month selected in the slicer for example all the inspections completed in May 2018.

 

An example of the data is below:

 

No.                    Account no          created date               Inspection type             completed date

1676731/05/2018normal05/06/2018
2196028/03/2018normal02/04/2018
3312222/02/2018normal27/02/2018
4219822/01/2018normal27/01/2018
5246521/05/2018advnaced26/05/2018
6204725/05/2018normal30/05/2018
7350706/06/2018advnaced11/06/2018
8118405/03/2018normal10/03/2018
9387208/06/2018advnaced13/06/2018
10175709/02/2018advnaced14/02/2018
11450731/05/2018advnaced05/06/2018
12231820/01/2018normal25/01/2018
13189724/02/2018advnaced01/03/2018
14410907/01/2018advnaced12/01/2018
15304431/05/2018advnaced05/06/2018
16220212/05/2018advnaced17/05/2018
17266304/05/2018advnaced09/05/2018
18319910/01/2018normal15/01/2018
19398718/02/2018advnaced23/02/2018
20187218/02/2018advnaced23/02/2018
21346011/05/2018advnaced16/05/2018

 

 

 

I have a date table and the date is linked to the completed date in my the inspection table.  I can created the completed table OK but when I try to create the created inspections table I don't get the correct results.  I have created an inactive relationship from the datetable to created date but I am unsure how to create a DAX calculation to use this.

 

Many thanks in advance

1 ACCEPTED SOLUTION

Hi,

 

It will take a lot of time for me to walk you through all that i have done.  To answer your specific question, the Custom column i created has converted two date columns into a single one by exploding each data of the date range into a single row.  This has been done so that we can relate this single column to the Date column of the Calendar Table.

 

Please feel free to ask any specific questions that you may have.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

12 REPLIES 12
Anonymous
Not applicable

try this:

 

[Measure that uses inactive relationship] =
CALCULATE (
    [Same Measure that the active relationship uses],
    USERELATIONSHIP ( DateTable[DateColumn], FactTable[created date] )
)
Anonymous
Not applicable

Hi

 

that's great thanks and helps sum up the number of created inspections.  What i need to do is show a list of created inspections and a list of closed inspections on the same report page using the same filters - similar to this.  At the moment both reports show the same inspections just with the created date or completed date Any ideas?  Thanks for your help.

 

inspections.PNG

hi @Anonymous,

 

Are these your expected results?

 

Untitled.pngUntitled1.pngUntitled2.pngUntitled3.pngUntitled4.pngUntitled5.png

 

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

yes @Ashish_Mathur!  I  would be very grateful if you could share how you have done this.

 

Many thanks

 

Jo.

Hi,

 

You may refer to my solution at this link.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hello Thank you for your help. I have downloaded your example but unfortunately cannot open the file. Please can you post the example pbix file please? Kind regards Jo.

Hi,

 

It will be the same link that i will share here as well.  There is no provision to upload files here.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hello

 

Thank you I have managed to download the pbix file now.  Please can you walk through what you have done.  I am a little confused where the a custom column has been created.

 

Many thanks

 

Jo

Hi,

 

It will take a lot of time for me to walk you through all that i have done.  To answer your specific question, the Custom column i created has converted two date columns into a single one by exploding each data of the date range into a single row.  This has been done so that we can relate this single column to the Date column of the Calendar Table.

 

Please feel free to ask any specific questions that you may have.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur apologies for the delay in replying to your message.  I have looked at your solution in detail and thank you for responding to my question.  I have applied your method to my data and all has worked.  Thanks again for taking the time to answer my question.

 

Kind regards

 

Jo

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

change the tablename[create date] to [completed date] in the USERELATIONSHIP() function.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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