Forum Discussion
Count row with same values in two columns
Hi There
I need help with some column "count"
| Project | Date | Text | Count |
P1 | 01.01.2021 | text1 | 1 |
| P1 | 01.01.2021 | text2 | 2 |
| P1 | 01.01.2021 | text3 | 3 |
| P1 | 02.01.2021 | text4 | 1 |
| P2 | 01.01.2021 | text5 | 1 |
| P2 | 01.01.2021 | text6 | 2 |
| P1 | 02.01.2021 | text7 | 2 |
| P1 | 02.01.2021 | text8 | 3 |
| P1 | 02.01.2021 | text9 | 4 |
I need to count number of rows when: Project is the same and Date is the same
i know it's not difficult, but unfortunately i can't find the right formula 😕
I am very grateful for every answer
Hi, RhoFox
Please check the below for creating a new column.
Count CC =
VAR currentproject = 'Table'[Project]
VAR currentdate = 'Table'[Date]
RETURN
RANKX (
FILTER (
'Table',
'Table'[Project] = currentproject
&& 'Table'[Date] = currentdate
),
'Table'[Text],
,
ASC
)
5 Replies
- selimovd
Most Valuable Professional
Hey RhoFox ,
you can do that with a CALCULATE and then you can tell which column should be considered for the count with the ALLEXCEPT function:
Count Measure = CALCULATE( COUNTROWS( myTable ), ALLEXCEPT( myTable, myTable[Project], myTable[Date] ) )If you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍Best regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic - vanessafvg
Community Champion
you can do a
summarizetable =
SUMMARIZE ( table[Project], table[Date], "RowCount", COUNTROWS ( table ) ) - Jihwan_Kim
Super User
Hi, RhoFox
Please check the below for creating a new column.
Count CC =
VAR currentproject = 'Table'[Project]
VAR currentdate = 'Table'[Date]
RETURN
RANKX (
FILTER (
'Table',
'Table'[Project] = currentproject
&& 'Table'[Date] = currentdate
),
'Table'[Text],
,
ASC
)- RhoFoxFrequent Visitor
ooooh it works 😄
thank you a lot
I just saw that I still have a problem, I have another column with true / false values, it should only count if the column = true- Jihwan_Kim
Super User
Hi, RhoFox
Thanks for your feedback.
Please share your sample pbix file's link here, then I can try to look into it.