cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AleksandrMe
Resolver I
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-21XXX1
2-Feb-21AAA2
3-Feb-21BBB3
3-March-21CCC4

 

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

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.

 

View solution in original post

3 REPLIES 3
ERD
Solution Sage
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)
)

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?! 

 

Any additional ideas?

Thnaks a lot

Aleks  

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.

 

View solution in original post

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

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.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

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

R2 (Green) 768 x 460px.png

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.