cancel
Showing results for
Did you mean:
Resolver I

## Count Rows up to date of Row

Good day Community,

I have made some research and afraid I cannot find the answer. I'm posting new question. I work with KPI now and I need to calculate number of rows every month and up to date. Unlike other KPI tables were result is calculated value - my actual result is number of rows. Each row represent submitted document,

 Date of Report Ship Name Number of Reports 1-Feb-21 XXX 1 2-Feb-21 AAA 2 3-Feb-21 BBB 3 3-March-21 CCC 4

What I’m looking to create column or measure which will count number of rows up to date of the current row. This is where I stuck as I need to use it for KPI targets for each month and year. I will use another data table with connection for my KPI targets, but for now I need to get this cumulative Number of Reports up to last date/each row date.

Tried all kind of functions and filters, I'm just not there yet....

Any ideas?

Thnaks a lot,

Aleks

1 ACCEPTED SOLUTION
Solution Sage

If you're using a calendar table with a year column (as an example), you need to create relations between your fact table and calendar table on the date column.

If you want your measure to be filtered by this slicer, then you need to change it a bit: use ALLSELECTED instead of ALL.

3 REPLIES 3
Solution Sage

Hello @AleksandrMe ,

Well, if your table demonstrates the final result (num of rows up to date in current row), then your measure might be:

``````#RowsNum =
VAR currentDate = SELECTEDVALUE(Table[Date])
RETURN
CALCULATE(
COUNTROWS(Table),
FILTER(ALL(Table),Table[Date] <= currentDate)
)``````
Resolver I

Hello @ERD

Thnaks for this measure, I think it works for me!!! Before acceting this as solution I have one more question.

I have 84 lines in this table and growing. I was thinking to use slicer for 2020/2021. Due to my limited understading of this new language I cannot figure out how to make it date slicer sensitive - for now  it soesnt react ot slicer?!

Thnaks a lot

Aleks

Solution Sage

If you're using a calendar table with a year column (as an example), you need to create relations between your fact table and calendar table on the date column.

If you want your measure to be filtered by this slicer, then you need to change it a bit: use ALLSELECTED instead of ALL.

Announcements

#### 2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

#### Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

#### Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors