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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
mottya
Frequent Visitor

Calculate no of customer until a selection is made in the filter

Hi

 

I have a delivery table that includes the customer ID and the delivery dates. It's connected to another table that contains the customer ID and the first date of delivery.

I want to know how many customers I have until a date I select in the filter (qtr or specific month)

for example, if I have three new customers on July 21 and 4 on August 21 and I choose September 21 (or Q3), I would like to see that I have seven customers

I tried some ways but failed

I hope someone can help me with that

Thanks

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, 

According to your description, I can roughly understand your requirement, I think you can create a calendar table and try this measure:

This is my test data:

vrobertqmsft_0-1636945431926.png

 

You can first create a calendar table like this:

calendar = CALENDARAUTO()

Then make sure it doesn’t have a relationship with the main table, then create a measure like this:

Customer count = CALCULATE(distinctCOUNT('delivery table'[Customer ID]),FILTER(ALL('delivery table'),[delivery date]<SELECTEDVALUE('calendar'[Date])))

 

And you can create slicer a measure to palce the date column in the calendar table and a card chart to place this measure, you can get what you want:

vrobertqmsft_1-1636945431932.png

 

You can download my test pbix file below

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-robertq-msft
Community Support
Community Support

Hi, 

According to your description, I can roughly understand your requirement, I think you can create a calendar table and try this measure:

This is my test data:

vrobertqmsft_0-1636945431926.png

 

You can first create a calendar table like this:

calendar = CALENDARAUTO()

Then make sure it doesn’t have a relationship with the main table, then create a measure like this:

Customer count = CALCULATE(distinctCOUNT('delivery table'[Customer ID]),FILTER(ALL('delivery table'),[delivery date]<SELECTEDVALUE('calendar'[Date])))

 

And you can create slicer a measure to palce the date column in the calendar table and a card chart to place this measure, you can get what you want:

vrobertqmsft_1-1636945431932.png

 

You can download my test pbix file below

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Super User
Super User

@mottya Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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