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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Memphis28
Frequent Visitor

Count entries after a date

Good afternoon

I am looking for a little guidance on something and fingers crossed someone can support.

I have data that contains a scheduled delivery date, the data also shows the  dates the customer has called in to speak to us. All i am trying to do is write a measure that will count all the dates of all calls made after the delivery date. 

You will have to excuse the use of excel, over powerbi, it is the only way i could quickly hide the customer details.

I have tried using an IF function with a > than but it always pulls all the calls and not just the data specific to each account so rather than 6 (from the example below) i am getting almost 4000.

So for example account 7401 had a delivery date on the 18/03 and has made 6 calls after this date. See data below:
End Result wanted:

Memphis28_1-1714390077568.png

 

Raw data

Memphis28_0-1714389845595.png
Hope this makes sense and thank you in advance.

M/28

 

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

Hi @Memphis28 ,

I create a table as you mentioned.

vyilongmsft_0-1714443594673.png

Then I create a measure and here is the DAX code.

Calls made after date =
VAR _currentAN =
    SELECTEDVALUE ( 'Table'[Account Number] )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( ALL ( 'Table' ), 'Table'[Account Number] = _currentAN )
    )

Finally you will get what you want.

vyilongmsft_1-1714443826096.png

 

 

 

Best Regards

Yilong Zhou

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

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Write this measure

Measure = countrows(filter(Data,Data[Call date]>Data[Delivery date]))

To your table visual, drag Account Number and this measure.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you for the help. I am still getting the same issue where it isn't referencing the correct delivery date based on the account. I get the following error:

Memphis28_0-1714463372585.png

If i enter Min or MAX to try and get around this error i get the same issue as before where it is adding all calls together and isn't dynamic based on the account. 
The data is coming from 3 different tables, all have relationships set up (correctly has far as i can tell) but could this be causing this issue?

Thanks in advance

M/28


Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yilong-msft
Community Support
Community Support

Hi @Memphis28 ,

I create a table as you mentioned.

vyilongmsft_0-1714443594673.png

Then I create a measure and here is the DAX code.

Calls made after date =
VAR _currentAN =
    SELECTEDVALUE ( 'Table'[Account Number] )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( ALL ( 'Table' ), 'Table'[Account Number] = _currentAN )
    )

Finally you will get what you want.

vyilongmsft_1-1714443826096.png

 

 

 

Best Regards

Yilong Zhou

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

Memphis28
Frequent Visitor

What may be of value but i am unsure is that the calls all have a qunique call reference ID in a seperate column if that makes it easier to count the individual calls coming in.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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