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
Doylejg3
Regular Visitor

Plotting Count of Records between dates

Hi There, new to Power BI and struggling with this question.  I'm trying to plot the number of active customers on each date using a line chart, like below:

 

Screenshot 2023-02-06 at 10.30.18 PM.png

 

I have one table I'm working with.  I need to count the distinct number customer ID's when the following criteria are met:

 

date is >= Cycle Start Date

AND

date is < Cycle End Date

 

Screenshot 2023-02-06 at 10.26.29 PM.png

 

I feel like I'm missing something obvious here.  Thank you for your help!

2 REPLIES 2
SadaqatUllah
New Member

To plot the number of active customers on each date in Power BI, you'll need to first create a calculated column that counts the distinct customer IDs based on the conditions you mentioned. To do this, you can use the DAX formula:

=COUNTD(FILTER(Table, [Date] >= [Cycle Start Date] && [Date] < [Cycle End Date]))

Once you have created this calculated column, you can then create a line chart visual by selecting the Date column as the X-axis and the calculated column as the Y-axis. This will display the number of active customers on each date, based on the conditions you specified.

Thank you for the help!  This definitely helped me get there.  I don't see any "COUNTD" function in Dax but maybe I don't totally understand how to use that.  I ended up using CALCULATE(DistinctCount(FILTER) and that worked for me.

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.