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
Super User
Super User

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.

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!