Forum Discussion
Counting Rows after a specific date
Hello Power BI Community,
I hope you are all keeping safe.
I have been at this for a few hours and either I am close or I am not approaching my desired output correctly.
What I have is a table of action items on a specific project and 11 of these items have a specific due date.
What I am looking for is to create a card that lists the items remaining due which I have made as:
Matthew
Please try a measure expression like this. You didn't mention that you have a Date table (a good practice), so this assumes you have a single table. Put it in a line chart with your Expected Date of Completion on the X axis.
Items Remaining =
VAR vMaxDate =
MAX ( datatable[Expected Date of Completion] )
RETURN
CALCULATE (
COUNT ( datatable[Expected Date of Completion] ),
ALL ( datatable[Expected Date of Completion] ),
datatable[Expected Date of Completion] > vMaxDate
)Pat
4 Replies
- mahoneypatMicrosoft Employee
Please try a measure expression like this. You didn't mention that you have a Date table (a good practice), so this assumes you have a single table. Put it in a line chart with your Expected Date of Completion on the X axis.
Items Remaining =
VAR vMaxDate =
MAX ( datatable[Expected Date of Completion] )
RETURN
CALCULATE (
COUNT ( datatable[Expected Date of Completion] ),
ALL ( datatable[Expected Date of Completion] ),
datatable[Expected Date of Completion] > vMaxDate
)Pat
- MatthewFieroHelper I
Thank you! The graph works. Are you able to explain why you used the ALL function? I am trying to understand the reasoning behind your code so I can better understand and grow my knowledge.
Thank you,
Matthew
- mahoneypatMicrosoft Employee
Without the ALL(), the evaluaton context of your measure is limited to the Date value at that point on the X axis. The var part of the new measure harvests that value to be used later. The ALL() removes the filter on the Date column, so that we can then filter it with a table/filter of Date values > the original Date. Note that in this context the REMOVEFILTERS() could have been used instead of ALL() which might be more intuitive of what it is doing.
CALCULATE in DAX #03: Remove single column filters - YouTube
Regards,
Pat
- v-xulin-mstfCommunity Support
Hi MatthewFiero
Could you provide sample data after removing sensitive information?
Sample data and expected output would help tremendously.
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/38490Best Regards,
Link