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

Count of open files

Hello,

 

I have a report in excel that I would like to convert to PowerBI.  I have a data set with one column of open dates and another of close dates.  I would like to create a graph, as below, which counts the number of files that have calendar dates that fall between an open and close date.

 

The purpose of the report is show how many open files there are at any given date as close dates for open files at set as 1-1-2099.

 

2018-11-01_10-48-06.jpg

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I just wanted to let you know I was able to get this to work using the following formula.

 

Measure = AVERAGEX (
    VALUES ( 'tbl_DATE_INFO'[DB_DATE] ),
    VAR CurrentDate = 'tbl_DATE_INFO'[DB_DATE]
    VAR ReceivedBeforeCurrentDate =
        FILTER (
            ALL ( 'rp_all_applicants'[receive_date] ),
            rp_all_applicants[receive_date] <= CurrentDate
        )
    VAR ClosedAfterCurrentDate =
        FILTER (
            ALL ( 'rp_all_applicants'[final_action_date] ),
            rp_all_applicants[final_action_date] >= CurrentDate
        )
    RETURN
        CALCULATE (
            COUNTROWS ( rp_all_applicants ),
            ReceivedBeforeCurrentDate,
            ClosedAfterCurrentDate,
            ALL ( 'tbl_DATE_INFO' )
        )
)

View solution in original post

3 REPLIES 3
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may set the relationship with calendar table and fact table. Then create the visual as requested. Show a simplified sample as below. If it is not your case, please share some data sample and expected output for your scenario so that we could help further on it.

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.
Anonymous
Not applicable

Hello,

 

Thank you for the reply.  I essentially need each calendar day to calculate how many files have a receive date greater than the calendar date in question and less than the final_action_date (IE close date)

 

I have included some sample data below with some PMI data excluded.  The count underneath the calendar dates are a product of the following calculation.  The calculation provided is in the first cell underneath 10/18/2018.

 

IF(AND(I$15>=$D16,I$15<=IF($E16="",$G$14,$E16)),1,0)

 

I15 = Calendar date of 10/18/2018

D16 = Receive_date (IE Open Date)

E16 = Final_Action_date (IE Close date)

 

The graph created by this data is in my first post.

 

association_nameg_numbercase_numberreceive_datefinal_action_dateBusTypeError 10/18/201810/19/201810/20/201810/21/201810/22/201810/23/2018
   18-Oct-1827-Oct-18Other  111111
   18-Oct-1822-Oct-18Other  111110
   18-Oct-1823-Oct-18Other  111111
   18-Oct-1819-Oct-18Other  110000
   18-Oct-1822-Oct-18Other  111110
   18-Oct-1822-Oct-18Other  111110
   18-Oct-1823-Oct-18Other  111111
   18-Oct-1823-Oct-18Other  111111
   18-Oct-1824-Oct-18Other  111111
   18-Oct-1823-Oct-18Other  111111
Anonymous
Not applicable

I just wanted to let you know I was able to get this to work using the following formula.

 

Measure = AVERAGEX (
    VALUES ( 'tbl_DATE_INFO'[DB_DATE] ),
    VAR CurrentDate = 'tbl_DATE_INFO'[DB_DATE]
    VAR ReceivedBeforeCurrentDate =
        FILTER (
            ALL ( 'rp_all_applicants'[receive_date] ),
            rp_all_applicants[receive_date] <= CurrentDate
        )
    VAR ClosedAfterCurrentDate =
        FILTER (
            ALL ( 'rp_all_applicants'[final_action_date] ),
            rp_all_applicants[final_action_date] >= CurrentDate
        )
    RETURN
        CALCULATE (
            COUNTROWS ( rp_all_applicants ),
            ReceivedBeforeCurrentDate,
            ClosedAfterCurrentDate,
            ALL ( 'tbl_DATE_INFO' )
        )
)

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.