cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cpatterson Regular Visitor
Regular Visitor

How to COUNTIF within a specified date range

Hi again,

 

I'm trying to use the Gauge visual to demonstrate target completion vs actual completion based on enrollment dates. I think I need a measure to calculate how many values are in a column, but I keep running in to errors while trying to use EDATE() so I'm not sure I'm doing it quite right.

 

There are four unique under "Learning Plan Name" all with respective "Subscription Date." If they have not completed the training, "Completion Date" remains blank; however, if they have completed training, "Completion Date" has a value.

 

pbi.png

What I would like it to do is count the # of values in the "Subscription Date" column within the time allocated to complete the training to be my "target value" on the gauge visual. For example, if Silver Reel has a deadline of 12 months, I would like it count anything in "Subscription Date" that is 12 months or greater from today's date. The other "Learning Plan Name" values all have a 12 month deadline, except for one, which has a 6 month deadline. I would like it to calculate everything that should be completed, essentially.

2 REPLIES 2
Super User
Super User

Re: How to COUNTIF within a specified date range

Hi @cpatterson 

 

Try the following measure:

 

Count plans out =
CALCULATE (
    COUNT ( 'Subscription Plans'[Learning Plan Name] );
    'Subscription Plans'[Completion] = "";
    FILTER (
        ALL (
            'Subscription Plans'[Subscription Date];
            'Subscription Plans'[Learning Plan Name]
        );
        'Subscription Plans'[Subscription Date]
            <= EDATE (
                TODAY ();
                IF ( 'Subscription Plans'[Learning Plan Name] = "Gold Reel"; -6; -12 )
            )
    )
)

Replace the column names by your model information and in the Gold Reel replace it by the plan that as only 6 months, in my example I call it Gold Reel to test out.

 

Regards,

MFelix



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

Proud to be a Datanaut!




cpatterson Regular Visitor
Regular Visitor

Re: How to COUNTIF within a specified date range

Hi @MFelix ,

Thank you for your help! Sorry for the delay in responding to this... I created the measure but when I add it to the visual (or any visual), it says "Can't display the visual."

 

Do you have an idea on what could be causing this?

 

Helpful resources

Announcements
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 402 members 3,822 guests
Please welcome our newest community members: