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
mdelasheras
Helper I
Helper I

How to filter count by another date filter

Hi all, 

 

I have a table like this one: 

JOBS

TO_DO : date

DONE: date

 

I also have a FILTER by TO_DO date (start/end)

 

I want to show how many jobs had to be done and how many were done filtering by date. 

Now I got a graph where I can see how many had to be done and how many have been done. The problem is I don't know how to filter the second date by the same range so some of them may be done out of range. 

 

doubt.png

 

I will add an example to clarify:

 

FILTER: 01/01/2018-31/03/2018

TO_DODONE
01/02/201801/02/2018
02/02/2018 
05/03/201808/03/2018
03/03/201804/04/2018
04/04/201804/04/2018

 

Now my output would say 4 (TO_DO) and 3 (DONE). It should be 4-2 because the last March Job was done out of range.

 

Hope my explanation is clear enough. Any tip? 

Thanks in advance!

4 REPLIES 4
MFelix
Super User
Super User

Hi @mdelasheras,

 

Taking into account that you are using two date columns you need to:

 

  • Create a calendar table
  • Make inactive relationships between calendar table and both date columns
  • Create the following measures:

 

TO_DO_count =
CALCULATE (
    COUNT ( JOBS[TO_DO] );
    USERELATIONSHIP ( 'Calendar'[Date]; JOBS[TO_DO] )
)


DONE_count =
CALCULATE (
    COUNT ( JOBS[TO_DO] );
    USERELATIONSHIP ( 'Calendar'[Date]; JOBS[DONE] )
)

 

  • Add the measures the date column from the calendar table to the chart
  • Make the slicer based on calendar table

Result is as below:

to_do.gif

 

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks @MFelix, very clear. 

Just one more thing, I would need to show only which jobs where done of those that had to be done in that period. I mean that case shouldn't be taking into account (second bar):

 

TO_DO: 12/12/2016 

DONE: 01/01/2018

 

There is a simple way to force the second count to be a subset of the first??

 

Hi @mdelasheras,

 

Not really sure what you want to have the done list is based on the filter dates so is within the subset.

 

can you explain a little better with examples.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix,

 

I need to count only those DONE jobs that had the TO_DO date between the filter dates. Let's see an example:

FILTER: 01/01/2018-31/03/2018

 

TO_DODONE
11/11/201701/02/2018 <-- doesn't count
12/12/201701/02/2018 <-- doesn't count
05/03/201808/03/2018
03/03/201804/04/2018
04/04/201804/04/2018

 

My output should be: 2-1 but now I'm getting 2-3 as result. Only those records remarked should be taken into account.

 

Thanks!

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.