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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
cpatterson
Helper I
Helper I

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
MFelix
Super User
Super User

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


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 ,

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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